Watchdog Timer Question


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2007
    Posts
    67

    Default Watchdog Timer Question

    My application requires long periods of sleep until an input is received (may be hours or weeks) - using RA2 wake on interrupt for this, and have WDT disabled to keep it from waking the Pic.

    However, sometimes the Pic is freezing up. Running a 16F616 via external oscillator at 20mhz, 5v supply. Works great 99% of the time, but when it does hang, it's a real problem.

    I know that's what the WDT was really designed to do, but not sure how it really does it. Here's what I want the Pic to do....

    1) If WDT times out during sleep - wake in the same spot of code (just like RA2 had generated the interrupt), check and see if it woke up because of RA2 or because of WDT. If WDT, then clear the bit and go back to sleep, if wake by RA2, continue on...

    OR (and this is the really important one I'm not sure I really understand)

    2) If the oscillator failed or the Pic hung, to generate a Power On Reset (or equivilant), basically, I want it to re-boot as if the power had been turned off and on and start fresh over.


    I'm not sure how it determines one of those 2 actions, and if it does reset due to a hang, if it really is a "complete" reset (like a POR would be)

    Thanks!

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by kevj View Post
    However, sometimes the Pic is freezing up. Running a 16F616 via external oscillator at 20mhz, 5v supply. Works great 99% of the time, but when it does hang, it's a real problem.
    Do you have the Power up timer turned on in the config bits?

    I'm not sure how it determines one of those 2 actions, and if it does reset due to a hang, if it really is a "complete" reset (like a POR would be)
    Apparently this PIC only directly differentiates between a Power On Reset and Brown Out Reset in the PCON register.
    But if you look around the datasheet, you'll find a number of registers that are zero'd out differently depending on the type of reset, such as ANSEL. On any reset, it's set to all 1's.
    And in the datasheet, it's states that during normal ops, a WDT reset, resets the chip like MCLR had been pulled down. But, if you put the PIC to SLEEP, a WDT causes the PIC to pick up where it left off without changing registers like a 'normal' reset would.

  3. #3
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Status Register may be of interest.

    Hi,

    The Status register contains two bits :

    1. Time Out (bit4)
    2. Power Down (bit3)

    A watchdog timer wakeup would cause the timeout to be zeroed.

    I didn't really get the hung part of your question. Is it no wakeup even after RA2 interrupt or hung in the mid of your app.Oscillators are turned of during the sleep mode (so your osc program counter, timer dependent on osc all freezes) the next instruction is prefetched. WDT has its own oscillator (internal RC). It could be startup problem for your crystal may be a 10Meg resistor between its legs would help or different cap values. Also use the powerup timer if your wake up event is not that time critical.
    Regards

    Sougata

Similar Threads

  1. Disable Watchdog timer?
    By Art in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 21st December 2009, 04:59
  2. Simple Timer question
    By jimseng in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 24th September 2009, 23:12
  3. Timer Question 16f877
    By Bonxy in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th November 2005, 08:40
  4. Timer / CCP Question
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd November 2005, 08:22
  5. Timer Question
    By aywho in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd October 2005, 21:54

Members who have read this thread : 0

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