8052
Microcontroller Tutorial
Time 2 as a Baud Rate Generator
Author : Craig Steiner
Book :
The
8051/8052
Microcontroller:
Architecture,
Assembly
Language,
And
Hardware
Interfacing
(Paperback)
TIMER 2 AS A BAUD-RATE GENERATOR
Timer 2 may be used as a baud rate generator. This is accomplished by setting either RCLK (T2CON.5) or TCLK (T2CON.4).
With the standard 8051, Timer 1 is the only timer which may be used to determine the baud rate of the serial port. Additionally, the receive and transmit baud rate must be the same.
With the 8052, however, the user may configure the serial port to receive at one baud rate and transmit with another. For example, if RCLK is set and TCLK is cleared, serial data will be received at the baud rate determined by Timer 2 whereas the baud rate of transmitted data will be determined by Timer 1.
Determining the auto-reload values for a specific baud rate is discussed in Serial Port Operation; the only difference is that in the case of Timer 2, the auto-reload value is placed in RCAP2H and RCAP2L, and the value is a 16-bit value rather than an 8-bit value.
NOTE: When Timer 2 is used as a baud rate generator (either TCLK or RCLK are set), the Timer 2 Overflow Flag (TF2) will not be set.
Reference links to Quality Microcontroller Based Schematics and Resource