Detect reset by WDT


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2003
    Posts
    985

    Default Detect reset by WDT

    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.

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default

    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 " !!!
    *****************************************

  3. #3
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default

    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.

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    Did you find this post helpful? Yes | No

    Default

    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.

  5. #5
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default

    The chip is an old 16F628.

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    Did you find this post helpful? Yes | No

    Default

    Hi Art,
    It looks like STATUS.4 is the bit you want to check, '0' if the WDT caused a reset.

    /Henrik.

  7. #7
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default

    Ah, I see, TimeOut bit, thanks

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts