On Thu, 20 Mar 1997 14:11:39 +0200 Corne Smith writes: >Hi dudes > >I've got a basic question that I still don't understand. > >What is the wachdog timer used for ? >I know it is used to reset the PIC,but why ? > >Cheers > >Corne > I think it's because ALL computers will crash, it's just a question of how long it will be until they crash. The watchdog timer detects the crash and resets the system. This compares favorably to a system I put in Kansas ten years or so ago where I had to drive over 100 miles to press the reset at a remote FM transmitter site. Now, EVERYHTING I do includes a watchdog! Another post asked why the watchdog kept resetting his PIC even though he had CLRWDT in his code. It IS important that the CLRWDT be executed BEFORE the WDT times out. It's pretty common to put a CLRWDT at ONE PLACE in the main program loop so if the processor doesn't make it around to there at least every so often, we assume the thing crashed and reset it. If the main loop has a smaller loop inside it that keeps the main loop from being completed in time, you can get a WDT timeout. I had this happen because of loops I put in to allow for A/D settling time. Finally, CLRWDT should NOT be put in an interrupt service routine since sometimes the main program can crash, but interrupts keep running fine. Harold