i~.
HARDWARE DESCRIPTION OF THE 8051,8052 AND 80C51
UsingTimer
1 to Generate Baud Rates
mode (high nibbleof TMOD = OO1OB), In that ease,
the baud rate is givenby the formula
When Timer 1 is used as the baud rate generator, the
baud rates in Modes 1 and 3 are determined by the
Modes 1, 3
2SMOD ~ OscillatorFrequency
Timer 1 overflowrate and the valueof SMOD as fol-
BaudRate = —
lows:
32
L% [256-
(THI)I
ModesL 3
2SMOD
One ean achievevery low baud
rates
with
T imer 1 by
BaudRate = —
X (Timer 1OverflowRate)
leavingthe Timer 1 interrupt enabl~ and mntlguring
32
the Timer to run as a 16-bit timer (hish nibble of
TMOD = OOOIB), and using the TiM~ I_interruptto
The Timer 1 interrupt shouldbe disabledin this appli-
do a lti-bit softwarereload.
cation. The Timer itself can be configuredfor either
"timer" or "cormter" operation, and in any of its 3
Figure 15lists variouseommordyused baud rates and
running modes. In the most typioaiaprdication~ it is
how they can be obtsined from Timer 1.
contl~ed for "timer" operati6n, in 'the auto-reload
I
Saud Rate
I
f~c
SMOD
Mode OMax:1 MHZ
12 MHZ
x
Mode2 Msx:375K
12 MHZ
1
Modes 1,3: 62.5K
12 MHZ
1
19.2K
11.059 MHZ
1
9.6K
11.059 MHZ
o
4.8K
11.059 MHZ
o
2.4K
11.059 MHZ
o
1.2K
11.059 MHZ
o
137.5
11.986 MHZ
o
110
6 MHZ
o
110
12 MHZ
o
Timer
Cfl
T
x
o
0
0
0
0
0
0
0
0
Mode
x
x
2
2
2
2
2
2
2
2
1
1
Reload
Value
x
x
FFH
FDH
FDH
FAH
F4H
E8H
lDH
72H
FEEBH
Figure 15.Timer 1 Ganerated Commonly Ueed Baud Rates
Using Timer 2 to Generate
SaudRates
11).Note then the baud rates for transmit and reoeive
can be simultaneously different.SettingRCLK and/or
In the 8052,Timer 2 is selectedas the baud rate genera-
TCLK puts Timer 2 into its baud rate generatormode,
tor by setting TCLK rind/or RCLKin T2CON (Figure
as shownin Figure 16.
piol?:lxcmm
ls -
Svam'rlz
r+l
+2
r=
2!3?'
Inm
Mm
-—
""-='
L.z.———
k.
" i
---amo
.,"
.W,
--
---
.,'
mx-
. ,, 1
"o-
------
+,'
'1' XCLOCK
270252-14
Figure 16. Timer 2 in Saud
RateGenerator Mode
3-16
Need help?
Do you have a question about the MCS 51 and is the answer not in the manual?