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 #237 background imageLoading...
Page #237 background image
infd.
87C51GB HARDWARE DESCRIPTION
7.4 SoftwareTimerMode
In most applicationsa softwaretimer is usedto trigger
interruptroutineswhichmustoccurat periodicinter-
vals. The user preloads a id-bit value in a module’s
compare registers.When a match occursbetweenthis
compare valueand the PCA timer value,an eventflag
is set and an interrupt can then be generated.
In the PCAcomparemode the 16-bitvalueofthe PCA
timer is comparedwitha Id-bitvaluepre-loadedin the
module’scompare registers (CCAPnH, CCAPnL) as
seen in Figure 20. The comparisonoccurs three times
per machinecyclein orderto r~gnize the fastestpas-
sible clock input (i.e. ~, X oscillator frequency).Set-
ting the ECOMnbit in the mode register CCAPMn
For the SoftwareTimermcde,the MATnbit alsoneeds
to be set. Whena matchoccursbetweenthe PCA timer
and the conqmreregisters,a match signalis generated
and the module’seventtlag(CCFn)is set.An interrupt
is then flaggedif the ECCFnbit is set. The PCA inter-
rupt is generatedonlyif it has been properlyenabled.
Softwaremustcleartheeventfig beforethe nextir2ter-
rupt willbe flagged.
Duringthe interruptroutine,a new id-bitcompareval-
ue can be written to the compare registers(CCAPnH
and CCAPnL). Notice, however, that a write to
CCAPnLclearstheECOMnbit whichtemporarilydis-
ablesthe comparatorfunctionwhiletheseregistersare
beingupdated so an invalidmatch does not occur.
A
write to CCAPnHsets the ECOMnbit and re-enables
a-bles the comparatorfunction. -
the comparator.For this reason, user softwareshoold
write
to CCAPnLfirst,then CCAPnH.
I
➤IN7ERRUPT
PcA
4
ENABLE
I
x
I
o
MATn
ECCFn
t
CCAPMn MOOE REGISTER
RESET
wRITETO
CCAPnL
a
,, ,,
0
WRmTO
CCAPnH
,,,.,
270897-22
Figure20.PCA16-BitComparatorMode:SoftwareTimer
6-29

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