Intel MCS 51 User Manual page 193

Table of Contents

Advertisement

in~.
8XC51FXHARDWARE DESCRIPTION
The baud rates in Modas 1 and 3 are deterrnin ed by
Timer 2's overflow rate as follows:
Modesland3Baud Rates = 'i'"'r20'''tO'Rate' Rate
The Timer can be contlgured for either "timer" or
"counter" operation. In most a~lications, it is config-
ured for "timer" operation (C/T2 = O).The "Timer"
operation is different for Timer 2 when it's being used
as a baud rate generator. Normally, as a timer, it incre-
ments every machine cycle (1/12 the oscillator frequen-
Cy).AS a baud rste generator, however, it increments
every state time (1/2the oscillatorfrequency).The baud
rate formula is given below:
Modes 1 and 3 =
Oscillator Frequency
Baud Rate
32 X [65536
- (RCAP2H,
RCAP2L)]
where (RCAP2H,
RCAP2L) is the content of
RCAP2H and RCAP2L taken as a l~bit unsigned
integer.
Timer 2 as a baud rate generatoris shown in Figure 23.
This tigureis valid only if RCLKand/or TCLK = 1 in
T2CON. Note that a rollover in TH2 does not set TF2,
and will not generatean interrupt.Therefore the Timer
2 interruptdoes not have to be disabled when Timer 2
is in the baud rate generator mode. Note too, that if
EXEN2 is seL a l-to-O transition in T2EX will set
EXF2 but will not cause a reload from (RCAP2H,
RCAP2L) to (TH2, TL2). Thus when Timer 2 is in use
as
a
baud rate generator, T2EX can be used as an extra
external interrupt, if desired.
It should be noted that when Timer 2 is *J3
w
= 1) in "timer" firncticmin the baud rate generator
mode, one should not try to reador write TH2 or TL2.
Under these conditions the Timer is being incremented
every state time, and the results of a read or write may
not be accurate. The RCAP2 registersmaybe read, but
shouldn'tbe written to, because a writemight overlap a
reload and cause write and/or reloademors. The timer
should be turned off (clear TR2) before accessing the
Timer 2 or RCAP2 registers.
Table 16 lists commonly used baud ratesand how they
can be obtained from Timer 2.
Baud
Rate
375K
9.6K
4.6K
2.4K
1.2K
300
110
300
110
Table 16.Timer
2 Generated
Commonly Used Baud Rates
Osc
Fraq
12 MHz
12 MHz
12 MHz
12 MHz
12 MHz
12 MHz
12 MHz
6 MHz
6 MHz
Timer 2
RCAP2H
FF
FF
FF
FF
FE
FB
F2
FD
F9
RCAP2L
FF
D9
B2
84
C8
IE
AF
8F
57
74
ml
Ovsnn.ow
+-l
r
Nom
Oec.
Psao.
taolnDao
BY 2, MOT 12.
D
+'2
I
-L
1
TH2
TLS
.Rx
Cmex
1 1
1 1
?
'—
I
RCAP2H
I
RCAP2L
r=
1
TX CLOCK
L
non! ~
OF
Amrnonu
axramsL
Wrremw'r
270S53-20
Figura 23. Timer 2 in Baud Rate Generator Mode
5-31

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents