mg82fel308 Megawin Technology, mg82fel308 Datasheet - Page 49

no-image

mg82fel308

Manufacturer Part Number
mg82fel308
Description
A Single-chip Microcontroller Based On A High Performance 1-t Architecture 80c51
Manufacturer
Megawin Technology
Datasheet
12.2.4. Programmable Clock Output from Timer 2 Structure
Note:
(1) Timer 2 overflow flag, TF2, will always not be set in this mode.
(2) For SYSCLK=12MHz, Timer 2 has a programmable output frequency range from 45.7Hz to 3MHz.
How to Program Timer 2 in Clock-out Mode
‧ Set T2OE bit in T2MOD register.
‧ Clear C/T2 bit in T2CON register.
‧ 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 TR2 bit in T2CON register to start the Timer 2.
12.2.5. Timer2 Register
T2MOD: Timer/Counter 2 Mode Control Register
SFR Address
SFR Page
Bit 7~5: Reserved.
Bit 4: T2X12, Timer 2 clock source selector.
0: Select SYSCLK/12 as Timer 2 clock source while T2CON.C/T2 = 0 in Capture Mode and Auto-Reload Mode.
1: Select SYSCLK as Timer 2 clock source while T2CON.C/T2 = 0 in Capture Mode and Auto-Reload
Bit 3~2: Reserved.
Bit 1: T2OE, Timer 2 clock-out enable bit.
0: Disable Timer 2 clock output.
1: Enable Timer 2 clock output.
Bit 0: DCEN, Timer 2 down-counting enable bit.
0: Timer 2 always keeps up-counting.
1: Enable Timer 2 down-counting ability.
This document information is the intellectual property of Megawin Technology.
© Megawin Technology Co., Ltd. 2009 All rights reserved.
QP-7300-03D
49/84
Timer 2 has a Clock-Out Mode (while CP/RL2=0 & T2OE=1). In this mode, Timer 2 operates as a programmable
clock generator with 50% duty-cycle. The generated clocks come out on P1.0. The input clock, SYSCLK/2,
increments the 16-bit timer (TH2, TL2). The timer repeatedly counts to overflow from a loaded value. Once
overflows occur, the contents of (RCAP2H, RCAP2L) are loaded into (TH2, TL2) for the consecutive counting.
The following formula gives the clock-out frequency:
In the Clock-Out mode, Timer 2 rollovers will not generate an 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.
T2 Clock-out Frequency =
--
7
R
MEGAWIN
MAKE YOU WIN
= All
= 0xC9
--
6
R
--
5
R
4 x (65536 – (RCAP2H, RCAP2L))
SYSCLK Frequency
T2X12
R/W
4
Reset Value= XXX0-XX00
--
3
R
--
2
R
T2OE
MG82FE(L)308/316
R/W
1
Preliminary, v 0.04
DCEN
R/W
0

Related parts for mg82fel308