Serial Port I/O

17.13.2 Transmit Block Baud Rate Computation

In this example, two different baud rate sources have been used, one for re- ceive, Timer 1 overflow, and the other for transmit, Timer 2 overflow. Of course, there is no good reason for this, except to show that it could be done, and to show how to use different timer modes for baud rate generation. The analyses for operational parameters for the individual timer overflow sources are de- scribed in the following paragraphs.

For the transmit baud rate generation, based on the SFR settings for the Timer 2 simulator peripheral, and the Timer 2 baud rate generator formulas outlined in the timer section of this manual, the communication baud rate computes as follows:

If the TM2 bit of CKCON is 0, then clock divide is fOSC/12.

BaudRate + fOSC

2 @ 16 @ (0x10000 * RCAP2)

RCAP2 is a concatenation of the SFR pair RCAP2H:RCAP2L. In this example, it carries a value of 0xFFC4. Hence, the generated baud rate works out to be 12 500bps.

If the faster clocking option of fOSC/4 was selected, then this equation must be modified to accommodate this faster operation.

If the TM2 bit of CKCON is 0, then clock divide is fOSC/4.

BaudRate + fOSC @ 3

2 @ 16 @ (0x10000 * RCAP2)

In this case, the generated baud rate computes to be 37 500bps. The factor of three is a result of the fact that the divide-by-4 factor option was selected, as opposed to the divide-by-12 option.

Of course, these baud rate values scale proportionally with the selected value for fOSC.

Keil Simulator

17-43

 

Page 271
Image 271
Texas Instruments MSC1210 manual Transmit Block Baud Rate Computation, BaudRate + fOSC @