in~e
8XC51FX HARDWARE DESCRIPTION
Table 8. T2CON:Timer/Counter 2 Control Register
T2CON
Svmbol
Address= OC8H
ResetValue= 0000OOOOB
BitAddressable
I
TF2 EXF2 RCLK TCLK EXEN2 TR2
cl= cPlm
Bit 7
6
5
4 3
2
1 0
Function
TF2
EXF2
RCLK
TCLK
EXEN2
TR2
c/E
cP/m
Timer2 overflow flagsetbyaTimer2overflowandmustbeclearedbysoftware.TF2will
notbesetwheneitherRCLK= 1orTCLK= 1.
Timer2externalflagsetwheneitheracaptureor reloadiscausedbya negativetransition
onT2EXandEXEN2= 1.WhenTimer2interruptisenabledEXF2= 1willcausetheCPU
tovectortotheTimer
2 interrupt routine. EXF2mustbeclearedbysoftware.EXF2doesnot
causeaninterruptinup/downcountermode(DCEN= 1).
Receiveclockflag.Whenset,causestheserialportto useTimer2overflowpulsesfor its
receiveclockin serialportModes1and3. RCLK= OcausesTimer1overflowto beused
forthereceiveclock.
Transmitclockflag.Whenset,causestheserialportto useTimer
2 overflowpulsesfor its
transmitclockin serialportModes1and3.TCLK= OcausesTimer1overflowsto beused
forthetransmitclock.
Timer2externalenableflag.Whenset,allowsa captureorreloadtooccurasaresultof a
negativetransitiononT2EXifTimer2is notbeingusedto clocktheserialport.EXEN2= O
causesThmer2to ignoreeventsat
T2EX.
Start/stopcontrolforTimer2. A logic1startsthetimer.
Timerorcounterselect.(Timer2)
O= Internaltimer(OSC/12orOSC/2inbaudrategeneratormode).
1 = Externaleventcounter(fallingedgetriggered).
Csoture/Reloadflaa.Whenset.cattureswill occuronneaativetransitionsatT2EXif
EXEN2 = 1.When;leared,aut&eloadswill occureitherfiith Timer2overflowsor
negativetransitionsatT2EXwhenEXEN2= 1.WheneitherRCLK= 1orTCLK= 1,this
bitisignored
and thetimerisforcedto auto-reloadonTimer2overflow.
CAPTURE MODE
16-bit timer or counter which upon overflow sets bit
TF2 in T2CON. This bit can then be used to generate
In the cmtrsremode there are two oDtionsselected bv SD
internmt.If EXEN2 = 1, Timer 2 still does the
bit EXEN2 in T2CON. If EXEN2 ~ O,Timer 2 is ~ above, bu; with the added f~ture that a l-to-O tran-
CAPTURE
TRANSITION
T
llMER 2
IN7ERRUPT
T22X PN
+! !~
2xF2
CONTROL
DZN2
270653-9
Figure 12.llmer 2in Capture Mode
5-16