|
MG87FX52 Datasheet, PDF (15/44 Pages) Megawin Technology Co., Ltd – 8 bits microcontroller | |||
|
◁ |
Megawin Technology Co., Ltd.
MG87FE/L52
8.0 Timer0, Timer1 & Timer2
8.1 Timers/Counters
MG87FE/L52 has three 16-bit timers, and they are named T0, T1 and T2. Each of them can also
be used as a general event counter, which counts the transition from 1 to 0.
While T0/T1/T2 is used as âtimerâ function, the time unit that used to measure the timer is
machine cycle. A machine cycle equals to 12 or 6 oscillator periods, and depends on 12T mode
or 6T mode that the user configured this device.
While T0/T1/T2 is used as â1-0 event counterâ function, the counting event is the âhigh-to-low
transitionâ of primitive pin T0/T1/T2. In this mode, the device periodically samples the status of
pin T0/T1/T2 once for each machine cycle. Whenever the sampled result turns from 1 to 0, the
device will count once on the counter. Be carefully, this kind of implementation for the counter
requires the high-duty or low-duty from pin T0/T1/T2 and must not too short compared to a
machine cycle.
There are two SFR designed to configure timers T0 and T1. They are TMOD, and TCON.
TMOD:
Timer-1
Timer-0
Bit7
Bit6
Bit5
Bit4
Bit3
Bit2
Bit1
Bit0
GATE
C//T
M1
M0
GATE
C//T
M1
M0
GATE
C//T
= 0, when TR0/1=1, Timer0/1 will be enabled.
= 1, Timer0/1 x is enabled only while â/INTxâ pin is high and âTR0/1â control bits is
set. That x=0 or 1.
= 0, active as timer function; (Default)
= 1, active as counter function.
M1 M0
Operating Mode
0
0 13-bit timer/counter for Timer0 and Timer1
0
1 16-bits timer/counter for Timer0 and Timer1
1
0 8-bits timer/counter with automatic reload for Timer0 and Timer1
1
1 (Timer 0) TL0 is 8-bit timer/counter, TH0 is locked into 8-bit timer
1
1 (Timer 1) Timer/Counter1 Stopped
Preliminary ver 1.3 Date: 2009-JAN-20 15
|
▷ |