Hardware Reference
In-Depth Information
This function simply restarts the D-Bug12 monitor, which will reinitialize all of D-Bug12's
internal tables and variables. Any previously set breakpoints will be lost. This function will not
be useful to user application development.
int getchar (void);
Pointer address: $EE84
This function retrieves a single character from the control terminal SCI. If an unread char-
acter is not available in the receive data register when this function is called, it will wait until
one is received. Because the character is returned as an integer, the 8-bit character is placed in
accumulator B.
Adding the following instruction sequence in your program will read a character from the
SCI0 port:
getchar
equ
$EE84
jsr
[getchar,PCR]
int putchar(int);
Pointer address: $EE86
This function outputs a single character to the control terminal SCI. If the control SCI's
transmit data register is full when the function is called, putchar() will wait until the transmit
data register is empty before sending the character. No buffering of characters is provided.
Putchar() returns the character that was sent. However, it does not detect any error conditions
that may occur in the process and therefore will never return EOF (end of file) . Adding the fol-
lowing instruction sequence in your program will output the character A to the control SCI
(when the program is running on a demo board, the character A will be displayed on the moni-
tor screen):
putchar
equ
$EE86
ldd
#'A'
jsr
[putchar,PCR]
int printf(char *format, . . .);
Pointer address: $EE88
This function is used to convert, format, and print its arguments on the standard out-
put (the output device could be the monitor screen, printer, LCD, etc.) under the control of
the format string pointed to by format. It returns the number of characters that were sent
to standard output (sent through serial port SCI0). All except floating-point data types are
supported.
The format string can contain two basic types of objects: ASCII characters that are cop-
ied directly from the format string to the display device, and conversion specifications that
cause succeeding printf() arguments to be converted, formatted, and sent to the display device.
Each conversion specification begins with a percent sign (%) and ends with a single conversion
character. Optional formatting characters may appear between the percent sign and end with a
single conversion character in the following order:
[ 2 ] [<FieldWidth>] [.] [<Precision>] [h | l]
These optional formatting characters are explained in Table 4.3.
The FieldWidth, or Precision, field may contain an asterisk (*) character instead of a number.
The asterisk will cause the value of the argument in the argument list to be used instead.
 
Search WWH ::




Custom Search