i~.
HARDWAREDESCRIPTION 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
WhenTimer 1 is used as the baudrate generator, the
baud rates in Modes 1 and 3 are determin
ed by the
Modes1,3 2SMOD
~ OscillatorFrequency
Timer 1 overflowrate and the valueof SMOD as fol-
BaudRate = ā
lows:
32 L%[256-
(THI)I
ModesL 3
2SMOD
One ean achieveverylowbaud
rateswithTimer 1 by
BaudRate = ā
X (Timer1OverflowRate)
leavingthe Timer 1interrupt enabl~ and mntlguring
32
the Timer to run as a 16-bit timer (hish nibble of
TMOD = OOOIB),and usingthe TiM~ I_interruptto
TheTimer 1interrupt 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 variouseommordyusedbaudrates and
runningmodes. In the most typioaiaprdication~it is
howthey can be obtsinedfrom Timer 1.
contl~ed for ātimerā operati6n,ināthe auto-reload
I
Saud Rate
I
f~c
SMOD
ModeOMax:1MHZ 12MHZ
x
Mode2 Msx:375K 12 MHZ 1
Modes 1,3: 62.5K 12MHZ 1
19.2K 11.059MHZ 1
9.6K 11.059MHZ o
4.8K 11.059MHZ o
2.4K 11.059MHZ o
1.2K
11.059MHZ o
137.5
11.986MHZ 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 simultaneouslydifferent.SettingRCLK and/or
In the 8052,Timer2 is selectedasthebaud rate genera- TCLK putsTimer2 into its baud rate generatormode,
tor bysettingTCLK 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 RateGeneratorMode
3-16