WATCHDOG

 

The AT89S8252 has a build in watchdog timer.

A watchdog timer is a timer that will reset the uP when it reaches a certain value.

So during program execution this WD-timer must be reset before it exceeds its maximum value. This is used to be sure a program is running correct.

When a program crashes or sits in an endless loop it will not reset the WD-timer so an automatic reset will occur resulting in a restart.

CONFIG WATCHDOG = value

value The time in mS it takes the WD will overflow, causing a reset.
Possible values are :
16,32,64,128,256,512,1024 or 2048
START WATCHDOG 'will start the watchdog timer.
STOP WATCHDOG 'will stop the watchdog timer.
RESET WATCHDOG 'will reset the watchdog timer.


Example


DIM A AS INTEGER
CONFIG WATCHDOG = 2048 'after 2 seconds a reset will occur
START WATCHDOG 'start the WD
DO
PRINT
a
a = a + 1 'notice the reset
REM RESET WATCHDOG 'delete the REM to run properly
LOOP
END