EasyManua.ls Logo

CMOSTEK CMT2380F17 - Page 152

Default Icon
347 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
CMT2380F17
Rev0.1 | 152/347
www.cmostek.com
frequency range from 91.5Hz to 6MHz.
Figure 16-24. Timer 2 in Clock-Out Mode
Timer 2 in Clock-Out Mode
• Select Timer 2 clock source.
• Determine the 16-bit reload value from the formula and enter it in the RCAP2H and RCAP2L
registers. Enter the same reload value as the initial value in the TH2 and TL2 registers.
• Set T2OE bit in T2MOD register.
• Set TR2 bit in T2CON register to start the Timer 2.
In the Clock-Out mode, Timer 2 rollovers will also generate a TF2 interrupt. This is similar to when Timer
2 is used as a baud-rate generator. It is possible to use Timer 2 as a baud rate generator and a clock
generator simultaneously. Note, however, that the baud-rate and the clock-out frequency depend on the same
overflow rate of Timer 2 and its interrupt will be blocked by TF2IG.
If Timer 2 in split mode, the clock output function is generated by TL2 overflow and the output clock
frequency is TL2 overflow rate /2. RCAP2L is the TL2’s reload value when TL2 overflow. There are four clock
source selections for TL2. Before enable split Timer 2 clock output function, software must finish the TL2 clock
source configuration. Figure 16–25 gives the formula of TL2 clock-out frequency: Figure 16–26 shows the
clock structure of Split Timer 2.
TL2 Clock Frequency
2 x (256 – RCAP2L)
Split T2 Clock-out Frequency =
Figure16-25. Split Timer 2 clock out equation
Note:
(1) TL 2 overflow flag, TF2L, will be set when TL2 overflows to generate interrupt. But, the TF2L interrupt is
enabled by TL2IE in T2CON register.
(2) For SYSCLK=12MHz and select SYSCLK/12 as TL2 clock source, TL2 has a programmable output
frequency range from 1.95KHz to 500KHz.
(3) For SYSCLK=12MHz and select SYSCLK as TL2 clock source, TL2 has a programmable output
frequency range from 23.44Hz to 6MHz.

Table of Contents