int&
87C51GB HARDWARE DESCRIPTION
~ 16
1
I ‘“4 :T ‘
16
1
16-BIT
MATCH
*
COMPARATOR
WDTE
I
I
ENABLE
I 1’1I
x
ECOM4 O 0
I
1
I
x
I
o
I
x
I
=--l
CCAPM4MOOEREGISTER
RES~
WRITETO
CCAP4L
,, ,,
0
WWE TO
CCAP4H
-
,,1,,
270S97-24
-.— -- . . . . . . — . . .
rlgurez. walcnaogmmerMoae
JOhold offthe ream the user has three options:
1.periodicallychangethe comparevalueso it willnev-
er match the PCA timer,
2.periodicallychange the PCA timer value so it will
nevermatch the comparevalue,
3.disablethe Watchdogbyclearingthe WDTEbit be-
forea match occurs and then later rc-enable it.
The first two options are more reliable because the
WatchdogTimeris neverdisabledas in option 4$3.The
secondoptionis not recommendedif other PCA mod-
ulesare beingused sincethis timer is the time base for
all five modules.11~ in moat applicationsthe fnt
solutionis the beat option.
The watchdogroutine shouldnot be part of an inter-
rupt service
routine.Why?Bwwse if the program
countergoesastray and gets stuck in an intinite loop,
interrupts will still be serviced,and the watchdogwill
notresetthe controller.Thus,thepurposeofthe watch-
dog would be defeated. Instead, call this subroutine
from the main program within 65536counts of the
PCAtimer.
7.7 PulseWidthModulatorMode
Any or all of the five PCA modulescan be pr~
grammedto be a Pulse Width Modulator.The PWM
outputcan be usedto convertdigitaldata
to an analog
~@ by ~ple m~ circuitry. The
frequencyofthe
PWM
dependson the clocksourcefor the PCA timer.
Witha 16MHz crystal the
maximumfrequencyof the
PWMwaveformis 15.6KHz. Table16showsthe vari-
ousfrequenciesthat are possible.
6-31