EasyManuals Logo

Intel MCS 51 User Manual

Intel MCS 51
334 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #151 background imageLoading...
Page #151 background image
i~e
8XC52/54/58 HARDWARE DESCRIPTION
operatingmodes:
Captur%auto-reload (up or down
counting), and baud rate generator.The modes are ae-
lected by bits in T2CON as shown in Table 4.
Timer 2 consists of two 8-bit registers, TH2 and TL2.
In the Timer function, the TL2 registeris incremented
everymachine cycle. Thus one can think of it as count-
ing machinecycles Siucea machine cycle consists of 12
oscillatorperioda,the count rateis 1/12of the oscillator
frequency.
ternafinput pin, T2. In this function, the externalinput
is sampled during S5P2 of every machine cycle. When
the samples show a high in one cycle and a low in the
next cycle, the count is irtcremented.The new count
value appearsin the register during S3P1 of the cycle
following the one in which the transition was detected.
Since it takes 2 machine cycles (24 oscillator periods) to
~- a l-to-o transition, the maximum count m~
IS1/2,of the oscillatorfrequency.To ensure that a given
level is sampled at least once before it changes, it
should be heid for at least one fidl machine cycl;.
In the Counter function, the registeris incremented in
responseto a l-to-Otransition at its corresponding ex-
Table 3. T2CON—Timer/Counter 2 Control Reaieter
T2CONAddress= OC8H ResetValue= 0000OOOOB
BitAddressable
TF2 EXF2 RCLK
TCLK EXEN2
TR2
cPfm cP/m
Bit
7 6 5 4
3
2 1 0
Symbol Function
TF2
Timer2 overflowflagsetbya Timer2 overflowandmustbeclearedbysoftware.TF2
willnotbesetwheneitherRCLK= 1 orTCLK= 1.
EXF2
Timer2 externalflag set wheneithera captureor reloadia causedbya negative
transitiononT2EXandEXEN2= 1.WhenTimer2 interruptisenabled,EXF2= 1will
causetheCPUto veetorto theTimer2 interruptroutine.EXF2mustbe clearedby
software.EXF2doesnotcauseaninterruptinup/downcounter
mode (DCEN = 1).
RCLK
Receiveclockenable.Whense~causestheserialporttouseTimer
2 overflowpulses
foritsreceiveclockinserialportModes1 and 3. RCLK = OcausesTimer1overflowto
beusedforthereceiveclock.
TCLK
Transmitclockenable.Whenset,causestheserialporttouseTimer
2 overflow pulses
for itstransmitclockinserialportModes1 and3. TCLK = (1~usgs Timgr 1 ovgrflows
tobeusedforthetransmitclock.
EXEN2
Timer2 externalenable.Whenset,allowsa ~ptureorreloadtooccurssa resultofa
negativetransitiononT2EXifTimer2 isnotbeingusedtoclocktheserialport.EXEN2
= OcausesTimer2 to ignoreeventsat T2EX.
TR2
Start/StopcontrolforTimer2.TR2 = 1 startsthetimer.
cm!
TimerorcounterselectforTimer2.C/~ = Ofortimerfunction.C/~ = 1forexternal
eventcounter(fallingedgetriggered).
cPlm
Capture/Reloadselect.CP/~ = 1causescapturestooccuronnegativetransitions
atT2EXifEXEN2= 1.CP/~ = OcausesautomaticreloadstooccurwhenTimer2
overflowsornegativetransitionsoccuratT2EXwhenEXEN2= 1.WheneitherRCLK
or TCLK= 1, thisbitis ignoredandthe timer
is forcedto auto-reloadon Timer2
overtlow.
4-5

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Intel MCS 51 and is the answer not in the manual?

Intel MCS 51 Specifications

General IconGeneral
BrandIntel
ModelMCS 51
CategoryMicrocontrollers
LanguageEnglish

Related product manuals