In general: A watchdog is any element of a design which is meant to detect and react to unintended failures. In the case of many microcontrollers with built in watchdog timers, the watchdog simply resets the machine, and sets some register to a particular state so that on reset the code can detect the watchdog event and act accordingly. Typically the watchdog is periodically 'refreshed' by correct operation of the code. This could be a write to a specific register, a defined sequence of writes with particular bytes to one or more registers, or toggling a hardware pin, perhaps in an interesting sequence. The idea is that you embed in you code this refresh so that when the code is operating correctly the refresh happens, and when it isn't the refresh doesn't occur, thus resetting your device to a known state. In the PIC the watchdog is a very simple single register write refresh. You can write anything to the register. This is nice, but certian kinds of runaway code (such as a memory clear routine) could still refresh the watchdog so the processor isn't reset. But with good design you can catch most of the problems that occur. The routine you might follow depends on your application. If you are developing a clock, for instance, then you know the display needs to be updated frequently - you could place the refresh inside the disply update routine. If the display isn't refreshed quickly enough, the watchdog resets the processor. If you are controlling a machine which has to stay inside certian bounds then you could update the watchdog every 20mS only as long as the location registers were within bounds. Idealy your program already takes care of that, but if a power glitch changes a register randomly without reseting the processor then your watchdog will catch it. There are several other good resources on watchdogs in general. I hope this helps! -Adam Mccauley, Daniel H wrote: >Being a high voltage / high power transmitter engineer by trade, I don't >have much experience with digital processor stuff like the PIC. Could >someone explain how watchdog timer routines are typically implemented and >some general guidelines??? > >Thanks much! > >D > >-- >http://www.piclist.com hint: PICList Posts must start with ONE topic: >[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > > > > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads