
Handshake Solutions
HT80C51 User Manual
Peripheral Modules – Standard Serial Interface (SIO0)
Page 40 of 132
© Philips Electronics N.V. 2005
5.3.5.
Setting up the serial port
[Table 8] summarizes the initialization values for SCON to select different modes of the UART.
baud rate
SCON
SM0
SM1
SIO mode
SMOD = 0
SMOD = 1
SM2 = 0:
single processor
environment
SM2 = 1:
multi processor
environment
0
0
1
1
0
1
0
1
mode 0: shift register
mode 1: 8bit UART
mode 2: 9bit UART
mode 3: 9bit UART
fsio_clk_i
ft01_overflow /32
fsio_clk_i /64
ft01_overflow /32
fsio_clk_i
ft01_overflow /16
fsio_clk_i /32
ft01_overflow /16
10H
50H
90H
D0H
NA
70H
B0H
F0H
[Table 8]
Serial Port Setup
5.3.5.1.
Generating Baud Rates
Serial Port in Mode 0:
Mode 0 has a fixed baud rate which is the frequency at clock input sio_clk_i. To run the serial port
in this mode none of the Timer/Counters need to be set up. Only the SCON register needs to be de-
fined.
i
clk
sio
f
Rate
Baud
_
_
=
Serial Port in Mode 1:
Mode 1 has a variable baud rate. Timer 1 generates the baud rate.
For this purpose, Timer 1 is used in mode 2 (Auto-Reload). Refer to the initialization section of the
timer description (Chapter 5.2.5).
()
[]
1
256
32
_
_
01
TH
f
K
Rate
Baud
i
clk
t
−
×
×
=
If SMOD = 0, then K = 1.
If SMOD = 1, then K = 2 (SMOD is in the PCON register).
Most of the time the user knows the baud rate and needs to know the reload value for TH1.
)
(
32
256
1
_
_
01
rate
baud
f
K
TH
i
clk
t
×
×
−
=
TH1 must be an integer value. Rounding off TH1 to the nearest integer may not produce the desired
baud rate. In this case, the user may have to choose another crystal frequency.
Since the PCON register is not bit addressable, one way to set the bit is logical ORing the PCON register
(i.e., ORL PCON,#80H). The address of PCON is 87H.
Serial Port in Mode 2:
The baud rate is fixed in this mode and is 1/32 or 1/64 of the frequency at clock input sio_clk_i,
depending on the value of the SMOD bit in the PCON register.