Z8 Microcontrollers
Serial I/O
ZiLOG
9-2
UM001600-Z8X0599
Configuration of the UART is controlled by the Port 3 Mode
Register (P3M) located at address F7H. The Z8 always
transmits eight bits between the start and stop bits (eight
Data Bits or seven Data Bits and one Parity Bit). Odd parity
generation and detection is supported.
The SIO Register and its associated Mode Control Regis-
ters are mapped into the Standard Z8 Register File as
shown in Table 9-1. The organization allows the software
to access the UART as general-purpose registers, elimi-
nating the need for special instructions.
9.2 UART BIT-RATE GENERATION
When Port 3 Mode Register bit 6 is set to 1, the UART is
enabled and T0 automatically becomes the bit rate gener-
ator (Figure 9-2). The end-of-count signal of T0 no longer
generates Interrupt Request IRQ4. Instead, the signal is
used as the input to the divide-by-16 counters (one each
for the receiver and the transmitter) that clock the data
stream.
The divide chain that generates the bit rate is shown in Fig-
ure 9-3. The bit rate is given by the following equation:
Bit Rate = XTAL Frequency/(2 x 4 x p x t x 16)
where p and t are the initial values in Prescaler0 and
Counter/Timer0, respectively. The final divide-by-16 is re-
quired since T0 runs at 16 times the bit rate in order to syn-
chronize on the incoming data.
To configure the Z8 for a specific bit rate, appropriate val-
ues as determined by the above equation must be loaded
into registers PRE0
(F5H) and T0 (F4H). PRE0 also controls the counting
mode for T0 and should therefore be set to the Continuous
Mode (D0 = 1).
Table 9-1. UART Register Map
Register
Name
Port 3 Mode
T0 Prescaler
Timer/Counter0
Timer Mode
UART
Hex
Identifier
P3M
PRE0
T0
TMR
SIO
Address
F7
F5
F4
F1
F0
Figure 9-2. Port 3 Mode Register (P3M) and Bit-Rate Generation
D7 D6 D5 D4 D3 D2 D1 D0
(Write-Only)
Port 3 Mode Register (P3M)
Register F7H
0 P30 Input and P37 = Output
1 P30 Serial In and P37 = Serial Out
Figure 9-3. Bit Rate Divide Chain
P
t
÷
16
Bit Rate
Clock
÷
4
÷
2
PRE0
T0
f
XTAL