PDA

View Full Version : What commands reset the WDT?



pointjohn
- 4th November 2010, 14:43
The problem is that I have never actually cleared the WDT in the code...but I've never seen it time out and reset the chip. I never intended to use the WDT with this application, but since its enabled by default, I never gave it a second thought. Could there be other commands that reset the WTD besides NAP, SLEEP, or CLEARWDT?

ScaleRobotics
- 4th November 2010, 15:06
Here is some info on the WDT from the manual.

The Watchdog Timer is used in conjunction with the SLEEP and NAP
instructions to wake the PIC MCU after a certain period of time.
Assembler instructions (clrwdt) to keep the Watchdog Timer from timing
out under normal circumstances and resetting the PIC MCU are
automatically inserted at appropriate places throughout the program.
CLEARWDT allows the placement of additional clrwdt instructions in the
program.

The Watchdog Timer is enabled by PBP. It is used, along with the TMR0
prescaler, to support the NAP and SLEEP instructions. If neither of the
instructions are used in a program, the Watchdog Timer may be disabled
and the prescaler used for something else.

If you want to tell PBP not to automatically insert the clrwdt instructions, you can use this define, and insert them yourself.

DEFINE NO_CLRWDT 1 ‘ Don’t insert CLRWDTs

But if you don't want to use it at all, you must turn it off in the configs.

pointjohn
- 4th November 2010, 15:11
Thanks for the information, this clears up a lot of issues

pointjohn
- 4th November 2010, 16:47
Another question: When/where does it decide to place these clears in the code? Im looking through the .asm file and I cannot find anything that looks like it.