MOTOROLA
9-18
ASYNCHRONOUS SERIAL COMMUNICATIONS INTERFACE
M68HC11
REFERENCE MANUAL
which caused the TxD line to go idle for enough time to trigger RWU. The new queued
idle function is much cleaner and easier to use.
The procedure for queueing an idle character is as follows. Write the last character to
the TDR and wait for TDRE to become set (indicates the last character has transferred
to the transmit shifter to be transmitted serially). Write zero and then write one to TE.
Since the last character is still being transmitted, the transmitter will not give up control
of the TxD pin, and the character being transmitted is undisturbed. The zero-to-one
transition of TE queues the idle character to be sent as soon as the transmit shifter
becomes available. As soon as TE is written back to one, the first character of the next
message may be written to the TDR. In this unusual case, the transmit queue can be
three characters deep: the last data character of the previous message still transmit-
ting, the queued idle character, and the first character of the next message in the par-
allel TDR.
One subtle aspect of the TxD pin buffer logic can be especially useful with the queued
idle function. In the previous queued idle discussion, it was assumed that the transmit-
ter would not relinquish control of the TxD pin because the last character was still be-
ing transmitted, but what if this character is completed while TE is zero This
completion could occur if the user is using a fast baud rate and the system is so busy
that there is a delay in responding to the TDRE request. The TxD pin will revert to the
general-purpose I/O function. If this scenario is a possibility, write bit 1 of PORTD and
DDRD to one. This configures the PD1/TxD pin to behave as an output and drive a
one if the transmitter relinquishes control of the pin. Since this pin state is identical to
an idle TxD line, the system would see a slightly longer than expected idle character
time.
Since the queuing of an idle character occurs at the
rising edge
of the TE bit, exactly
one idle character results from the queueing procedure. There is never any possibility
of a second idle character being produced because of uncertainty about the relation-
ship between the software and the internal baud-rate clock (as there was with queued
break characters).
9.3.5 Disabling the SCI Transmitter
Writing a zero to TE requests that the transmitter stop when it can. The transmitter will
finish any transmission in progress before actually shutting down. Only an MCU reset
can cause the transmitter to stop and shut down immediately.
If TE is written to zero when the transmitter is already idle, the pin will revert to its gen-
eral-purpose I/O function (synchronized to the bit-rate clock). If anything is being trans-
mitted when TE is written to zero, that character is completed before the pin reverts to
general-purpose I/O, but any other characters waiting in the transmit queue are lost.
The TC and TDRE flags are set at the completion of this last character even though
TE has been disabled.
9.3.6 TxD Pin Buffer Logic
Several features of the TxD pin buffer logic are especially important to an SCI user.
When the SCI transmitter is enabled, the data direction control is overridden, and the