View Full Version : watch dog timer ?
amgen
- 18th January 2009, 18:22
I am wondering if the wdt will re-start the PIC if prog execution somehow stops,
is there a way to test the wdt ?
don
amgen
Bruce
- 19th January 2009, 15:27
I am wondering if the wdt will re-start the PIC if prog execution somehow stops
Yes. If program execution stops, and you have the WDT enabled, it will cause a reset. That's what it's for.
There are some exceptions like entering SLEEP, and waking up with the watch-dog timer where it will continue executing code after the sleep instruction, but this is all in the data sheet and easy to lookup.
is there a way to test the wdt ?
No, but some PICs have a register that indicates what caused a device reset.
amgen
- 19th January 2009, 17:43
thanks Bruce,
I had an idea in the middle of the night that I tried, which seemed to work.
take a pin and use for an input push-button switch,
in a PICbasic program, test for sw push then do.........
asm
here nop
goto here
endasm
.....a dead end loop with no wdt-reset
the pic would re-start normal operation after a period and timed out with different settings of wdt timeout.
it would not be a bad reset type initiated by a push-button.
don
amgen
Bruce
- 19th January 2009, 18:20
Hi Don,
Very cool idea. Using the assembler loop, PBP can't reset WDT...;o}
Edit: I was just thinking. You can force the same timeout period for the WDT reset by inserting a clrwdt instruction just above the loop label. Thanks for sharing the idea. I have something I'm working on now where this works great.
Powered by vBulletin® Version 4.1.7 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.