14
AVR 132 Application Note
2551A–AVR–11/03
The WDT Interrupt handler is implemented as described in Figure 5 on page 7. The
Sleep Enable bit is used as a Wakeup flag. When Command 1 is executed, the applica-
tion resets the WDT, sets the Sleep Enable bit and then enters sleep mode. The
interrupt handler is executed when the WDT timeout wakes up the CPU, and the
Wakeup flag decides what action to take. If it is already cleared, an error has occurred
and the failure LED is lit. The rest of the interrupt handler implementation complies with
the flowchart.
The rest of the code is the same as described in the first example.
Literature References
Michael Barr – Introduction to Watchdog Timers
http://www.embedded.com/story/OEG20010920S0064
Niall Murphy – Watchdog Timers
http://www.embedded.com/2000/0011/0011feat4.htm
Jack Ganssle – Born to Fail
http://www.embedded.com/design_library/OEG20021211S0032
Kernighan & Ritchie – “The C Programming Language”, 2
nd
edition.