Download C868 8 - SELF8051
Transcript
C868 On-Chip Peripheral Components T2CON) must be set. To enable the baud generator for receive, bit RCLK (bit 5 of special function register T2CON) must be set. With the timer 2 as clock source for the serial port in mode 1 and 3, the baud rate can be determined as follows: Mode 1, 3 baud rate = 2SMOD 32 x (timer 2 overflow rate) Timer 2 overflow rate = system frequency / 2x(216 – RC2) with RC2 = RC2H.7..0, RC2L.7..0 and timer2 count direction is set to up. Using Timer 1 to Generate Baud Rates In modes 1 and 3 of the serial interface timer 1 can also be used for generating baud rates. Then the baud rate is determined by the timer 1 overflow rate and the value of SMOD as follows: Mode 1, 3 baud rate = 2SMOD 32 x (timer 1 overflow rate) The timer 1 interrupt is usually disabled in this application. Timer 1 itself can be configured for either "timer" or "counter" operation, and in any of its operating modes. In most typical applications, it is configured for "timer" operation in the auto-reload mode (high nibble of TMOD = 0010B). In this case the baud rate is given by the formula: 2SMOD x system frequency Mode 1, 3 baud rate = 32 x 12 x (256 – (TH1)) Very low baud rates can be achieved with timer 1 if leaving the timer 1 interrupt enabled, configuring the timer to run as 16-bit timer (high nibble of TMOD = 0001B), and using the timer 1 interrupt for a 16-bit software reload. User’s Manual 4-106 V 1.0, 2003-01