AT898252 WATCHDOG

Top  Previous  Next

The AT89S8252 has a built 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.

 

START WATCHDOG        will start the watchdog timer.

STOP WATCHDOG        will stop the watchdog timer.

RESET WATCHDOG        will reset the watchdog timer.

 

See also

CONFIG WATCHDOG

 

 

Example

'-----------------------------------------------------

'                (c) 1998 MCS Electronics

' WATCHD.BAS demonstrates the AT89S8252 watchdog timer

' select 89s8252.dat !!!

'-----------------------------------------------------

Config Watchdog = 2048                  'reset after 2048 mSec

Start Watchdog                          'start the watchdog timer

Dim I As Word

For I = 1 To 10000

Print I                               'print value

'  Reset Watchdog

'you will notice that the for next doesnt finish because of the reset

'when you unmark the RESET WATCHDOG statement it will finish because the

'wd-timer is reset before it reaches 2048 msec

Next

End