EasyManuals Logo

Atmel 8051 User Manual

Atmel 8051
113 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #98 background imageLoading...
Page #98 background image
Common Features Description
2-97 Atmel 8051 Microcontrollers Hardware Manual
4316B–8051–02/04
Figure 2-22. Timer 2 in Baud Rate Generator Mode.
The baud rate generator mode is similar to the auto-reload mode, in that a rollover in
TH2 causes the Timer 2 registers to be reloaded with the 16-bit value in registers
RCAP2H and RCAP2L, which are preset by software.
Now, the baud rates in Modes 1 and 3 are determined by Timer 2’s overflow rate as
follows:
The Timer can be configured for either “timer” or “counter” operation. In the most typical
applications, it is configured for “timer” operation (C/T2
= 0). “Timer” operation is a little dif-
ferent for Timer 2 when it’s being used as a baud rate generator. Separately as a timer it would
increment every machine cycle (thus at 1/12 the oscillator frequency). As a baud rate generator,
however, it increment every state time (thus at 1/2 the oscillator frequency).
Timer 2 as a baud rate generator is shown in Figure 2-22. This Figure is valid only if
RCLK + TCLK = 1 in T2CON. Note that a rollover in TH2 does not set TF2, and will not
generate an interrupt. Therefore, the Timer 2 interrupt does not have to be disabled
when Timer 2 is in the baud rate generator mode. Note too, that if EXEN2 is set, a 1-to-
0 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 running (TR2 = 1) inTimer” function in the baud
rate generator mode, one should not try to read or write TH2 or TL2. Under these condi-
tions the Timer is being incremented every state time, and the results of a read or write
may not be accurate. The RCAP registers may be read, but shouldn’t be written to,
because a write might overlap a reload and cause write and/or reload errors. In this
case, turn the Timer off (clear TR2) before accessing the Timer 2 or RCAP registers.
Periph
Clock
1

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Atmel 8051 and is the answer not in the manual?

Atmel 8051 Specifications

General IconGeneral
BrandAtmel
Model8051
CategoryMicrocontrollers
LanguageEnglish

Related product manuals