Using Timer 2

8.5.4Timer 2 as a Baud Rate Generator

Timer 2 can be used as a baud rate generator. This is accomplished by setting either RCLK (T2CON.5) or TCLK (T2CON.4).

With Timer 1, the receive and transmit baud rate must be the same. With Timer 2, however, the user can configure the serial port to receive at one baud rate and transmit at another. For example, if RCLK is set and TCLK is cleared, seri- al data is received at the baud rate determined by Timer 2, whereas the baud rate of transmitted data is determined by Timer 1.

Determining the auto-reload values for a specific baud rate is discussed in Chapter 9, Serial Communication. The only difference is that in the case of Timer 2, the auto-reload value is placed in RCAP2H and RCAP2L, and the val- ue is 16-bit rather than 8-bit.

Note:

When Timer 2 is used as a baud rate generator (either TCLK or RCLK are set), the Timer 2 overflow flag (TF2) is not set.

8-16

Page 90
Image 90
Texas Instruments MSC1210 manual Timer 2 as a Baud Rate Generator