Texas Instruments MSC1210 User Manual

Page 272

Advertising
background image

Serial Port I/O

17-44

17.13.3

Receive Block Baud Rate Computation

Timer 1 is set for a mode 2 timer operation in an 8-bit auto-reload capacity. This
is achieved by assigning a 0x20 value to the TMOD SFR. Recall that the
SMOD0 bit of PCON has been set in an earlier section of this program. This
effectively doubles the communication baud rate. Based on the baud rate com-
putation formulas, it was determined that the desired 12 500 or 37 500 baud
rate settings could be attained by assigning a value of 0xFB to the TH1 SFR.

If the TM2 bit of CKCON is 0, then clock divide is f

OSC

/12.

BaudRate

+

2

SMOD

@

f

OSC

32

@

12

@

(256

*

TH1)

And if the TM2 bit of CKCON is 1, then clock divide is f

OSC

/4

BaudRate

+

2

SMOD

@

f

OSC

32

@

4

@

(256

*

TH1)

This forces a factor of two in the numerator in either case because SMOD car-
ries a value of one. For the case in which the T1M bit of CKCON is cleared,
the value of 12 in the denominator is a consequence of the f

OSC

/12 option se-

lected, whereas the factor of 4 in the denominator of the second expression
is a consequence of choosing the f

OSC

/4 option. With the value for TH1 set at

0xFB, the first expression results in a baud rate of 12 500bps, while the second
expression results in a baud rate value of 37 500bps. Whatever the case may
be, the correct value of the transmit and/or receive baud rates are properly re-
flected in the non-editable transmit baud rate and receive baud rate windows,
respectively.

A value of 0x48 is assigned to the TCON SFR. This sets its TR1 (Timer 1 run)
bit and its INT1 bit. Actually, in this example, because we are not gating Timer
1, the status of INT1 is irrelevant.

If the TR1 check box is cleared—setting the TR1 bit of TCON to 0—Timer 1
stops running, and the receive baud rate value becomes 0.

Advertising