Texas Instruments MSC1210 manual 2. Common Baud Rates Using Timer, BaudRate + 32 @ Timer1Overflow

Models: MSC1210

1 324
Download 324 pages 20.97 Kb
Page 98
Image 98

Setting the Serial Port Mode

The baud rate is adjustable and is based on either Timer 1 or Timer 2. Serial Port 0 can use either Timer 1 or Timer 2, while Serial Port 1 can use only Timer 1. On an overflow from the timer, a clock is sent to the baud clock. The clock is divided by 16 to generate the baud clock. The PCON.SMOD0 and EICON.SMOD1 bits determine whether or not to divide Timer 1 by the rollover rate of 2. The equation for baud rate is given below:

2SMOD

BaudRate + 32 @ Timer1Overflow

It is recommended to use Timer 1 in mode 2 (8-bit counter with auto-reload). This changes the equation to:

2SMOD

 

fOSC

BaudRate + 32

@

 

12 @ (256 * TH1)

The divide-by-12 can be changed to 4 by setting CKCON.T1M.

To determine the reload value from a given baud rate, use the equation below:

TH1

+ 256

*

2SMOD @ fOSC

384 @ BaudRate

 

You can also achieve very low baud rates from Timer 1 by enabling T1CON.TF1, configuring the timer for mode 1, and using the timer interrupt to initiate a 16-bit software reload, as shown in Table 9−2.

Table 9−2. Common Baud Rates Using Timer 1

 

 

 

 

 

 

TH1 Value for an

Baud Rate

SMODx

C/T

 

Timer 1 Mode

11.0592MHz fOSC

57.6k

1

0

 

2

0FFH

19.2k

1

0

 

2

0FDH

9.6k

1

0

 

2

0FAH

4.8k

1

0

 

2

0F4H

2.4k

1

0

 

2

0E8H

1.2k

1

0

 

2

0D0H

When using Timer 2 for the baud rate clock, the equation is:

BaudRate + Timer2Overflow

16

To use Timer 2 as the baud rate generator, configure Timer 2 in auto-reload mode and set T2CON.TCLK and T2CON.RCLK (to select Timer 2 as the baud- rate generator for the transmitter and receiver, respectively). Setting T2CON.TCLK and T2CON.RCLK will disable the setting of T2CON.TF2 and the reload on 1-to-0 on T2. The 16-bit reload value is stored in RCAP2L and RCAP2H, which gives the following equation:

BaudRate +fOSC

32 @ (65536 * (RCAP2H : RCAP2L))

9-8

Page 98
Image 98
Texas Instruments MSC1210 2. Common Baud Rates Using Timer, BaudRate + 32 @ Timer1Overflow, BaudRate + 12 @ 256 * TH1