PDA

View Full Version : WDT-Reset - How to know



BigWumpus
- 11th November 2005, 14:47
Hello,

we implement the WDT in our code.
How it is possible to check out, if there was a WDT-Reset ?

In the init-Part of my code, I check the Bit TO to be cleared and PD to be set (this is the setting after a WDT-Reset), but I think the PicBasic kills them while working on his Reset-Code....

PIC16F876

;Reset ?
Stat_POR=0:If POR_=0 Then Stat_POR=1:POR_=1
;WDT ?
Stat_WDT=0:IF (TO_=0) AND (PD_=1) Then Stat_WDT=1

BigWumpus
- 12th November 2005, 17:33
I've found the solution

PicBasic insert CLRWDT-commands, before the TO-Bit is checked. But the CLRWDT-command sets the bit !
So I use some asm on the first lines of the programm to save the STATUS-register.

@ movf STATUS,w
@ movwf _dummy

;-)