Intel 8XC251SP Microscope & Magnifier User Manual


 
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)×
------------------------- -------------------------------------------------------------=