11.1.5 Programmable Clock-Out from Timer 0
Using Timer 0, a 50% duty cycle clock can be programmed to come out from pin T0CKO (P3.4).
The clock-out frequency depends on the system clock frequency (Fosc) and the reload value filled in the TH0
register, as shown in the following formula:
Fosc
Clock-Out Frequency =
n x (256-TH0)
Where,
n=24 if T0X12=0,
n=2 if T0X12=1.
Timer 0 is programmed for the clock-out mode as follows:
• Set T0CKOE bit in AUXR2 register.
• Clear C/-T bit of Timer 0 in TMOD register.
• Clear GATE bit of Timer 0 in TMOD register.
• Determine the 8-bit reload value from the formula and enter it in TH0 register.
• Enter an 8-bit initial value in TL0 register. It should be the same as the reload value.
• Start the timer by setting the run control bit TR0 in TCON register.
Figure 11-5. Programmable Clock-Out from Timer 0
Fosc
12
"0"
"1"
D
Clock-Out
(P3.4)
Q
Q
"0"
Overflow
TL0
(8 Bits)
CK
T0X12
C/-T=0
Load
TR0
TH0
(8 Bits)
GATE=0
/INT1 pin
* Fosc is the system clock.
MEGAWIN
MPC82G516A Data Sheet
44