mg82fel308 Megawin Technology, mg82fel308 Datasheet - Page 46

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.2. Auto-Reload Mode (AR) Structure
Figure 12-6 Timer 2 in Auto-Reload Mode (DCEN=0)
This document information is the intellectual property of Megawin Technology.
© Megawin Technology Co., Ltd. 2009 All rights reserved.
QP-7300-03D
46/84
Figure 12-6 shows DCEN=0, which enables Timer 2 to count up automatically. In this mode there are two options
selected by bit EXEN2 in T2CON register. If EXEN2=0, then Timer 2 counts up to 0FFFFH and sets the TF2
(Overflow Flag) bit upon overflow. This causes the Timer 2 registers to be reloaded with the 16-bit value in
RCAP2L and RCAP2H. The values in RCAP2L and RCAP2H are preset by firmware. If EXEN2=1, then a 16-bit
reload can be triggered either by an overflow or by a 1-to-0 transition at input T2EX. This transition also sets the
EXF2 bit. The Timer 2 interrupt, if enabled, can be generated when either TF2 or EXF2 are 1.
Fig 12-7 shows DCEN=1, which enables Timer 2 to count up or down. This mode allows pin T2EX to control the
counting direction. When a logic 1 is applied at pin T2EX, Timer 2 will count up. Timer 2 will overflow at 0FFFFH
and set the TF2 flag, which can then generate an interrupt if the interrupt is enabled. This overflow also causes
the 16-bit value in RCAP2L and RCAP2H to be reloaded into the timer registers TL2 and TH2. A logic 0 applied
to pin T2EX causes Timer 2 to count down. The timer will underflow when TL2 and TH2 become equal to the
value stored in RCAP2L and RCAP2H. This underflow sets the TF2 flag and causes 0FFFFH to be reloaded into
the timer registers TL2 and TH2.
The external flag EXF2 toggles when Timer 2 underflows or overflows. This EXF2 bit can be used as a 17th bit of
resolution if needed. The EXF2 flag does not generate an interrupt in this mode.
SYSCLK
SYSCLK
MEGAWIN
MAKE YOU WIN
12
T2EX Pin
T2 Pin
T2MOD.T2X12=0
T2MOD.T2X12=1
Transition
Detection
C/T2=0
C/T2=1
EXEN2
TR2
Reload
RCAP2L
(8 Bits)
TL2
RCAP2H
(8 Bits)
TH2
Overflow
MG82FE(L)308/316
EXF2
TF2
Preliminary, v 0.04
Timer2 Interrupt

Related parts for mg82fel308