This article is a watchdog timer example.
The watchdog timer is a counter that must be cleared within the watchdog time period. If a clearing does not occurs then the counter reaches a predeterminted by the programmer number of counted pulses and it generates a reset causing a system reboot.
Pease, read it:Watchdog timer, Maxim
Here we reuse the C code of example3 of article no 9 , doing watchdog timer resets in program time-delay loops inside of interrupt blocks. If watchdog timer reset is dissabled in a block then an error is occured.
To do a reset of the watchdog timer we use the SRVWDT macro defined in the wdt.h file.
Also observe how while(1); is rewritten.
To configure the watchdog timer you can use DAVE.
Watchdog ok watchdog producing error The result |