Watchdog Timer


Closed Thread
Results 1 to 4 of 4

Thread: Watchdog Timer

  1. #1
    barkerben's Avatar
    barkerben Guest

    Default Watchdog Timer

    Hi,

    I wrote some code wich works fine - but someone asked be why it didn't constantly reset due to the WDT. I didn't know, and was a bit worried. Maybe my code shouldn't be working after all, in which case why was it...I searched the forum and found:

    "WDT is handled automatically for you by PBP in background - you don't have to do anything. If you look at the Assembler listing of any of your compiled programs, you will see a liberal sprinkling of CLRWDT instructions throughout. PBP puts them there to keep resetting the WDT so you don't have to."

    Posted by Melanie a while back.

    What then is the advantage of using the WDT at all - would it not save code space to disable it in config bits, or is it sometimes useful?

    Cheers,


    Ben

  2. #2
    barkerben's Avatar
    barkerben Guest


    Did you find this post helpful? Yes | No

    Default

    P.S

    I've seen in the manual that the WDT is used in sleep commands, which may be why it is not completely disabled. But if the compiler is constantly clearing the timer to stop it overflowing, how can it be put to good use for the sleep commands ....?

  3. #3
    Join Date
    May 2004
    Location
    New England
    Posts
    164


    Did you find this post helpful? Yes | No

    Default

    I'd guess that PBP does not clear the WDT (except as needed to do its timing duties) while executing a SLEEP command.

    The WDT is still useful in that if your code hangs (and the WDT stops being cleared), you'll get a WDT reset to reboot your software.

  4. #4
    barkerben's Avatar
    barkerben Guest


    Did you find this post helpful? Yes | No

    Default

    Yes, although any use made of the WDT can't allow it to overflow, because as soon as it does it resets the pic. Maybe the sleep commands are just advanced with each advance of the WDT - assuming the reset doesn't introduce a delay, then
    the sleep commands would still work - they would still get a pulse every period ...?

Similar Threads

  1. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  2. High Resolution Timer & Speed Calculator
    By WOZZY-2010 in forum Code Examples
    Replies: 4
    Last Post: - 7th February 2010, 16:45
  3. Disable Watchdog timer?
    By Art in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 21st December 2009, 04:59
  4. Timer interrupt frequency
    By Samoele in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th January 2009, 23:49
  5. Watchdog Timer Question
    By kevj in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th March 2008, 01:56

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