Kicking The Watchdog
As has been explained, the watchdog will wait for the configured amount of time. If the watchdog determines that the program has crashed, it will trigger a Watchdog Interrupt (if
EWDI is set) after the configured amount of time. 128 Instruction cycles later, if the program still appears to be crashed, it will reboot the system.
In order to prevent a watchdog reboot, your software must let the watchdog know that it is still alive. It does this by executing the following code:
MOV TA,#0AAh ;Execute the Timed Access Protection MOV TA,#55h ;code to open the Timed Access window SETB RWT ;Reset the watchdog timer by setting the RWT bit
Setting the RWT bit (WDCON.0) is how your program lets the watchdog know that everything is ok--that your program
hasn't crashed. Doing so will reset the watchdog timer.
You may be asking, "What are those first two MOV instructions for?" The
RWT bit is a "protected bit." You may not write to it without executing the two MOV instructions. Note that you must also execute those two same instructions before modifying
WDCON.0, WDCON.1, and
WDCON.3.
Please see the chapter regarding "Timed Access Protection" for a more full discussion of why this is necessary.
Click
here for
>>>>
Dallas
80C320 -
Chapter
3.2 (Using
the
Watchdog
Interrupt) |