in~.
87C51GB HARDWAREDESCRIPTION
In the auto-reloadmodewith DCEN = O,there are
two options selected by bit EXEN2 in T2CON. If
EXEN2 = O,Timer2 countsup to OFFFFH
and then
setsthe TF2bit uponovertlow.The ovezilowalsocaus-
es the timer registers to be reloaded with the 16-bit
value in RCAP2H and RCAP2L. The values in
RCAP2H and RCAF2L are preaet by software. If
EXEN2 = 1,a id-bit reloadcarsbe triggeredeither by
an overflowor by a l-to-Otransitionat
externalinput
T2EX. This transition also sets the EXF2 bit. Either
the TF2 or EXF2bit can generatethe Timer 2 inter-
rupt if it is enabled.Figure 13showstimer 2 automati-
cdy counting
Up whenDCEN = O.
Settingthe DCENbit enablesTimer 2 to count up or
downas show-nin Figure 14.In this modethe T2EX
pin czmtrolsthe directionof count.A logic1 at T2EX
makes Timer 2 count up. The timer wiUovertlowat
OFFFFHand set the TF2 bit whichcan then generate
an interrupt if it is enabled.This overtlowalso causes
the 16-bitvalue in RCAP2H and RCAP2Lto be re-
loadedinto the timer regis~ TH2and TL2, respec-
tively.
A logicOat T2EX makes Timer 2 count down.Now
the timer undertows when TH2 and TL2 equal the
vahs stored in RCAP2H and RCAP2L.‘he under-
OVERFLOW
72PN
7s2
RELOAD
~
TRAtmnol
OETscnob
J
AL
TIMER2
INTERRuPT
T2EXPIN
~\
I CONTROL
SX;N2
270897-15
Figure13.Timer2AutoReloadMode(DCEN= O)
(OOWNCOUNTNGRELOAOVALUE)
I
FFH : FFH
I
TOGGLE
TR2
AL
COUNT
DIRECITDN
1 = UP
o = OOWN
(UPCOUNTINGRELOAOVALUE)
❑
T2EXPIN
270897-16
Figure14.Timer2AutoReloadMode(DCEN= 1)
6-19