User`s manual
BL1600 System Development s 43
Serial Communication
RS-232 Communication
Z-World has RS-232 support libraries for the Z180s Ports 0 and 1, and for
the XP8700 expansion board. Functional support for serial communica-
tion includes the following.
Initialization of the serial ports.
Monitoring and reading a circular receive buffer.
Monitoring and writing to a circular transmit buffer.
An echo option.
CTS (clear to send) and RTS (request to send) control.
XMODEM protocol for downloading and uploading data.
A modem option.
Receive and Transmit Buffers
Serial communication is made easier with a background interrupt routine
that updates receive and transmit buffers. Every time a port receives
another character, the interrupt routine places it into the receive buffer.
Your program can read the data one character at a time or as a stream of
characters terminated by a special character.
A program sends data by writing characters into the transmit buffer. If the
serial port is not already transmitting, the write functions will automatically
initiate transmission. Once the last character of the buffer is sent, the
transmit interrupt is turned off. Data can be written one character at a time
or as a stream of characters.
Echo Option
If the echo option is turned on during initialization of the serial port (with
Dinit
_
z0, Dinit
_
z1, or Dinit
_
uart) any character received is
automatically echoed back (transmitted out). This feature is ideal for use
with a dumb terminal and also for checking the characters received.
CTS/RTS Control
Z180 Port 0 is constrained by hardware to have the CTS (clear to send)
pulled low by the RS-232 device to which it is talking. An XP8700,
however, can enable or disable the effect of the CTS line. Z180 Port 1
does not support the CTS/RTS lines.
If you choose the CTS/RTS option, the support software will pull the RTS
(request to send) line high when the receive buffer has reached 80% of its
capacity. Thus, the transmitting device (if its CTS is enabled) will stop
transmitting. The RTS line is pulled low again when the received buffer
has gone below 20% of its capacity.