Wagner Lipnharski says:
...you can think about the WDT as a real dog that wants to bite your leg if you don't feed him every certain time.... :) It means what? If you leave your house [ed:or your mind], the next intruder will have severe leg dog marks...The main reason of the WDT is that software sometimes got lost, enter in infinite loops, some unexpecetd situation puts a routine to go crazy and all. The WDT unique intention is to reset the machine if certain programmable timer expires. So, your "normal operative" software should "reset" the WDT before it resets the machine, so if you program the WDT to 1 second, you should reset (CLRWDT [ed:on the pic, clr !wdt on the SX]) before that happens. If you routine gets lost, the WDT will reset your machine in one second, so not much is wasted. [ed: unless the machine gets lost in a loop that clears the WDT... think about it before you write it...]
The best WDT I ever seen, was an interrupt that run 10 times faster than the WDT timer. Several routines actually update their respectively flags at one especific memory position. The interrupt routine check those flags and clear them. Some flags should be set by its routines much often than others. The interrupt routine knew that and act accordingly. If by some reason one routine fails to update its flag, the interrupt routine was able to reset the memory pointers and data for that particular routine and reset it without needing to reset the entire processor. If the failing routine doesn't restart nicely, then the interrupt routine propositaly fails to clear the WDT, it resets the entire processor.
Harold Hallikainen says:
In terms of computers (including PICs and SXs), I don't think it's a question of IF they will crash, but more a question of WHEN they will crash. Having a WDT allows the system to recover from the crash. I once had to drive 100 miles through Kansas in the middle of the night to hit reset on a system I built to control broadcast transmitters so the station could go back on the air at 6am. EVERYTHING I've built from then on includes a watchdog timer...
You can also use the PIC and SX WDTs to measure Temperature
Questions:
Hello you all,
I get in trouble with a PIC16F88.
Just after a new programming of the board the PIC works well and then a day later the same board does not work anymore....
My board is intended to communicate with a RS232 plug into a PC and check the temperature thru an anlogic port AN0.
To try to find out a way to solve this problem, I have got rid of the part of the program which is related to RS232 MAXIM "MAX232ACPE" although this chip is still connected on the PIC.
The board does not work any better
This is the fuse list:
#ZERO_RAM
#FUSES WDT //Watch Dog Timer
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES PUT //Power Up Timer
#FUSES MCLR //Master Clear pin enabled
#FUSES BROWNOUT //brownout reset
#FUSES NOLVP //No low voltage prgming,
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOFCMEN //No Fail-safe clock monitor enabled
#FUSES NOIESO //No Internal External Switch Over mode enabled
#use delay(clock=4000000,RESTART_WDT)
Can you help me ?
See: