beautypg.com

8 pca watchdog timer – Rainbow Electronics T89C51CC01 User Manual

Page 113

background image

113

T89C51CC01

Rev. D – 17-Dec-01

Figure 45. PCA PWM Mode

16.8 PCA Watchdog
Timer

An on-board watchdog timer is available with the PCA to improve system reliability with-
out increasing chip count. Watchdog timers are useful for systems that are sensitive to
noise, power glitches, or electrostatic discharge. Module 4 is the only PCA module that
can be programmed as a watchdog. However, this module can still be used for other
modes if the watchdog is not needed. The user pre-loads a 16-bit value in the compare
registers. Just like the other compare modes, this 16-bit value is compared to the PCA
timer value. If a match is allowed to occur, an internal reset will be generated. This will
not cause the RST pin to be driven high.

To hold off the reset, the user has three options:

1. periodically change the compare value so it will never match the PCA timer,

2. periodically change the PCA timer value so it will never match the compare
values, or

3. disable the watchdog by clearing the WDTE bit before a match occurs and then
re-enable it.

The first two options are more reliable because the watchdog timer is never disabled as
in option #3. If the program counter ever goes astray, a match will eventually occur and
cause an internal reset. If other PCA modules are being used the second option not rec-
ommended either. Remember, the PCA timer is the time base for all modules; changing
the time base for other modules would not be a good idea. Thus, in most applications
the first solution is the best option.

CL rolls over from FFh TO 00h loads
CCAPnH contents into CCAPnL

CCAPnL

CCAPnH

8-Bit
Comparator

CL (8 bits)

“0”

“1”

CL < CCAPnL

CL >= CCAPnL

CEX

PWMn

CCAPMn.1

ECOMn

CCAPMn.6