8XC196NT USER'S MANUAL
7.3
SERIAL PORT MODES
The serial port has both synchronous and asynchronous operating modes for transmission and re-
ception. This section describes the operation of each mode.
7.3.1
Synchronous Mode (Mode 0)
The most common use of mode 0, the synchronous mode, is to expand the I/O capability of the
device with shift registers (see Figure 7-2). In this mode, the TXD pin outputs a set of eight clock
pulses, while the RXD pin either transmits or receives data. Data is transferred eight bits at a time
with the least-significant bit first. Figure 7-3 shows a diagram of the relative timing of these sig-
nals. Note that only mode 0 uses RXD as an open-drain output.
Clock Inhibit
Serial In
V
CC
Serial
In B
Clear
Figure 7-2. Typical Shift Register Circuit for Mode 0
In mode 0, RXD must be enabled for receptions and disabled for transmissions. (See "Program-
ming the Control Register" on page 7-8.) When RXD is enabled, either a rising edge on the RXD
input or clearing the receive interrupt (RI) flag in SP_STATUS starts a reception. When RXD is
disabled, writing to SBUF_TX starts a transmission.
Disabling RXD stops a reception in progress and inhibits further receptions. To avoid a partial or
undesired complete reception, disable RXD before clearing the RI flag in SP_STATUS. This can
be handled in an interrupt environment by using software flags or in straight-line code by using
the interrupt pending register to signal the completion of a reception.
7-4
Q#
Shift Register
74HC165
Inputs
Outputs
Shift Register
74HC164
Shift / LOAD#
V
CC
74HC05
15KΩ
Serial In A
Clock
P x . x
Data
RXD
Clock
TXD
8XC196
Device
Enable#
P x . x
A0264-02