Hi Guys,
Is there a way to detect in a program whether the program is starting
from a power on reset or a reset forced by the watchdog timer?
Cheers, Art.
Hi Guys,
Is there a way to detect in a program whether the program is starting
from a power on reset or a reset forced by the watchdog timer?
Cheers, Art.
Hi, Art
Yess, of course !
see the RESET chapter of the Pic® Datasheet you use. i.e. Table 14.4 for the 16F628a ...
Everything explained for the registers to check.
Alain
Last edited by Acetronics2; - 12th April 2010 at 13:25.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
I didn't see a reset chapter, but did notice that T1CON register is always set
to zero on powerup, but remains unchanged for any other reset.
Since I'm not using timer 1, I just set one of the prescaler bits somewhere
in my program, and then check for the value of T1CON where I want to check
whether reset was caused by watchdog timer.
Art,
Which PIC are you using? On the 18F2431, for example, there's the RCON register which contains the bits telling you what caused the reset. In this case RCON.3 ill be '0' when the WDT timed out and caused a reset.
/Henrik.
Hi Art,
It looks like STATUS.4 is the bit you want to check, '0' if the WDT caused a reset.
/Henrik.
Bookmarks