User`s manual
BL1600 System Development s 59
The serial ports can be polled or interrupt-driven.
A polling driver tests the ready flags (TDRE and RDRF) until a ready
condition appears (transmitter data register empty or receiver data register
full). If an error condition occurs on receive, the routine must clear the
error flags and take appropriate action, if any. If the /CTS line is used for
flow control, transmission of data is automatically stopped when /CTS
goes high because the TDRE flag is disabled. This prevents the driver
from transmitting more characters because it thinks the transmitter is not
ready. The transmitter will still function with /CTS high, but exercise care
since TDRE is not available to synchronize loading the data register (TDR)
properly.
An interrupt-driven driver works as follows. The program enables the
receiver interrupt as long as the program wants to receive characters. The
transmitter interrupt is enabled only while characters are waiting in the
output buffer. When an interrupt occurs, the interrupt routine must
determine the cause: receiver data register full, transmitter data register
empty, receiver error, or /DCD0 pin high (channel 0 only). None of these
interrupts is edge-triggered. Another interrupt will occur immediately if
interrupts are re-enabled without disabling the condition causing the
interrupt. The signal /DCD0 needs special attention because it cannot be
disabled while the receive interrupts are on. The /DCD0 line on the
BL1600 is grounded to take it out of the picture.