mg82fel308 Megawin Technology, mg82fel308 Datasheet - Page 45

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. Timer2
Timer 2 is a 16-bit Timer/Counter which can operate either as a timer or an event counter, as selected by C/T2 in
T2CON register. Timer 2 has four operating modes: Capture, Auto-Reload (up or down counting), Baud Rate
Generator and Programmable Clock-Out, which are selected by bits in the T2CON and T2MOD registers.
12.2.1. Capture Mode (CP) Structure
Figure 12-5 Timer 2 in Capture Mode
This document information is the intellectual property of Megawin Technology.
© Megawin Technology Co., Ltd. 2009 All rights reserved.
QP-7300-03D
45/84
In the capture mode there are two options selected by bit EXEN2 in T2CON. If EXEN2=0, Timer 2 is a 16-bit
timer or counter which, upon overflow, sets bit TF2 (Timer 2 overflow flag). This bit can then be used to generate
an interrupt (by enabling the Timer 2 interrupt bit in the IE register). If EXEN2=1, Timer 2 still does the above, but
with the added feature that a 1-to-0 transition at external input T2EX causes the current value in the Timer 2
registers, TH2 and TL2, to be captured into registers RCAP2H and RCAP2L, respectively. In addition, the
transition at T2EX causes bit EXF2 in T2CON to be set, and the EXF2 bit (like TF2) can generate an interrupt
which vectors to the same location as Timer 2 overflow interrupt. The capture mode is illustrated in Figure 12-5.
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
Capture
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