User manual
Monitor12 (MON12) User Manual 05/30/01
4
I/O ROUTINES
The I/O section of the main module consists of a set of supervisor routines, and
three sets of driver routines. The supervisor routines are INIT, INPUT, and
OUTPUT. These routines determine which driver subroutine to call to perform the
specific action. Each set of driver routines consists of an initialization
routine, an input routine, and an output routine. One set of drivers is for the
SCI port and these routines are called ONSCI, INSCI, and OUTSCI.
All I/O communications are controlled by three RAM locations (IODEV, EXTDEV, and
HOSTDEV). EXTDEV specifies the external device type (0=none, l=SCI1). HOSTDEV
specifies which I/O port is used for host communications (O=SCI, 1=SCI1). IODEV
instructs the supervisor routine which port/driver routine to use (0=SCI,
1=SCI1).
The INIT routines set up a serial transmission format of eight data bits, two
stop bits, and no parity. For the SCI, the baud rate is set to 9600 for a 16MHz
crystal (8MHz E-clock). To achieve a different baud rate the baud rate control
registers can be modified using the MM command. For the SCI, this means
modifying the SCOBDH and SCOBDL registers (refer to MCU data sheet, SCI baud
rate selection).
The INPUT routine reads from the specified port. If a Character is received,
the character is returned in accumulator A. If no character is received a zero
(0) is returned in accumulator A. This routine does not wait for a character to
be received before returning (this function performed by the INCHAR subroutine).
The OUTPUT routine takes the ASCII character loaded in accumulator A and writes
to the specified I/O port. This routine waits until the character is
transmitted before returning.
UTILITY SUBROUTINES
Several subroutines exist that are available for performing I/O tasks. A jump
table has been set up in ROM directly beneath the interrupt vectors. To use
these subroutines, execute a jump to subroutine (JSR) command to the appropriate
entry in the jump table. By default, all I/O performed with these routines is
sent to the terminal port. Redirection of the I/O port is achieved by placing
the specified value (O=SCI, 1=SCI1) into RAM location IODEV.
Utility subroutines available to the user are as follows:
UPCASE If character in accumulator A is lower case alpha, convert to upper
case.
WCHEK Test character in accumulator A and return with Z bit set if
character is white space (space, comma, tab).
DCHEK Test character in accumulator A and return with Z bit set if
character is delimiter (carriage return or white space).
INIT Initialize I/O device.
INPUT Read I/O device.
OUTPUT Write I/O device.