8XC51FXHARDWAREDESCRIPTION
sition at extermdinput T2EX causeathe current value
in the Timer 2 registers,TH2 and TL2, to be captured
into registersRCAP2H and RCAP2~ respectively. In
addition, the transition at T2EX eausea bit EXF2 in
T2CON to be set. The EXF2 bit, like TF2, ean generate
an interrupt.The capture mode is illustrated in Figure
12.
AUTO-RELOAD MODE
(UP OR DOWN COUNTER)
defauh to count up. When DCEN is set, Timer 2 ean
count up or down dependingon the value of the T2EX
pin.
Figure 13 showsTimer 2 automatically counting up
when DCEN = O.In this mode there are two options
seleeted by bit EXEN2 in T2CON. If EXEN2 = O,
Timer 2 counts up to OFFFFH and then sets the TF2
bit upon overflow. The overflowalso causes the timer
registers to be reloaded with the 16-bit value in
RCAP2H and RCAP2L. The values in RCAP2H and
Timer 2 canbe progrsmmed to
emmtup or down when
RCAP2L are presetby software.If EXEN2 = 1, a 16-
eonfigured in its 16-bit auto-reload mode. This feature
bit reloadcan be triggeredeitherby an overtlowor by a
is invoked by a bit named DCEN (Down CmrnterEn-
l-to-o transition at external input T2EX. This tran-
able) located in the SFR T2MOD (see Table 9). Upon
sition also sets the EXF2 bit. Either the TF2 or EXF2
reset the DCEN bit is set to Ow that Timer 2 will
bit can generatethe Timer 2 interruptif it is enabled.
Table 9. T2MOD:
Timer2ModeControl Register
I
I
T2MOD Address= OC9H
Reset Value= XXXXXXOOB
I
NotBit Addressable
I
— —
— — — —
T20E DCEN
Bit 7 6
5
4
3 2
1
0
Symbol Function
—
Notimplemented,reservedforfutureuse.*
T20E
Timer2OutputEnablebit.
DCEN DownCountEnablebit.Whenset,thisallowsTimer2to beconfiguredasanup/down
counter.
‘User software should not write 1s to reserved bits.These bitemaybe usedinfuture8051 familyproductsto invoke
newfeaturea.In thatcase, the resetor inaetivsvalueof the newbitwillbe O,and itsactivevaluewillbe 1. The value
read froma reservedbitis indeterminate.
OVSSFLOW
TR2
RELOAD
7SANSITION
OETEC7YJN
1
A.
T2EXPIN
~x~~
EXF2
CONTROL
nws 2
IN7ESRUPT
EXiN2
2706S-10
Figure 13. Timer 2 Auto Rslosd Mode (DCEN = O)
5-17