8XC251SA, SB, SP, SQ USER’S MANUAL
8-14
8.6.3
Baud Rate Generator Mode
This mode configures timer 2 as a baud rate generator for use with the serial port. Select this mode
by setting the RCLK and/or TCLK bits in T2CON. See Table 8-3. For details regarding this mode
of operation, refer to section 10.6, “Baud Rates.”
8.6.4
Clock-out Mode
In the clock-out mode, timer 2 functions as a 50%-duty-cycle, variable-frequency clock (Figure
8-10). The input clock increments TL0 at frequency F
OSC
/2. The timer repeatedly counts to over-
flow from a preloaded value. At overflow, the contents of the RCAP2H and RCAP2L registers
are loaded into TH2/TL2. In this mode, timer 2 overflows do not generate interrupts. The formula
gives the clock-out frequency as a function of the system oscillator frequency and the value in the
RCAP2H and RCAP2L registers:
For a 16 MHz system clock, timer 2 has a programmable frequency range of 61 Hz to 4 MHz.
The generated clock signal is brought out to the T2 pin.
Timer 2 is programmed for the clock-out mode as follows:
1.
Set the T2OE bit in T2MOD. This gates the timer register overflow to the ÷2 counter.
2.
Clear the C/T2# bit in T2CON to select F
OSC
/2 as the timer input signal. This also gates the
output of the ÷2 counter to pin T2.
3.
Determine the 16-bit reload value from the formula and enter in the RCAP2H/RCAP2L
registers.
4.
Enter a 16-bit initial value in timer register TH2/TL2. This can be the same as the reload
value, or different, depending on the application.
5.
To start the timer, set the TR2 run control bit in T2CON.
Operation is similar to timer 2 operation as a baud rate generator. It is possible to use timer 2 as
a baud rate generator and a clock generator simultaneously. For this configuration, the baud rates
and clock frequencies are not independent since both functions use the values in the RCAP2H
and RCAP2L registers.
Clock-out Frequency
F
OSC
4
(65536 - RCAP2H, RCAP2L)
×
--------------------------------------------------------------------------------------
=
Summary of Contents for 8XC251SA
Page 2: ......
Page 3: ...May 1996 8XC251SA 8XC251SB 8XC251SP 8XC251SQ Embedded Microcontroller User s Manual...
Page 18: ......
Page 19: ...1 Guide to This Manual...
Page 20: ......
Page 30: ......
Page 31: ...2 Architectural Overview...
Page 32: ......
Page 41: ...3 Address Spaces...
Page 42: ......
Page 63: ...4 Device Configuration...
Page 64: ......
Page 81: ...5 Programming...
Page 82: ......
Page 102: ......
Page 103: ...6 Interrupt System...
Page 104: ......
Page 120: ......
Page 121: ...7 Input Output Ports...
Page 122: ......
Page 132: ......
Page 133: ...8 Timer Counters and Watchdog Timer...
Page 134: ......
Page 153: ...9 Programmable Counter Array...
Page 154: ......
Page 170: ......
Page 171: ...10 Serial I O Port...
Page 172: ......
Page 187: ...11 Minimum Hardware Setup...
Page 188: ......
Page 197: ...12 Special Operating Modes...
Page 198: ......
Page 206: ......
Page 207: ...13 External Memory Interface...
Page 208: ......
Page 239: ...14 Programming and Verifying Nonvolatile Memory...
Page 240: ......
Page 250: ......
Page 251: ...A Instruction Set Reference...
Page 252: ......
Page 390: ......
Page 391: ...B Signal Descriptions...
Page 392: ......
Page 400: ......
Page 401: ...C Registers...
Page 402: ......
Page 436: ......
Page 437: ...Glossary...
Page 438: ......
Page 446: ......
Page 447: ...Index...
Page 448: ......
Page 458: ......