Timer and long (hours) sleep period - how to?


Results 1 to 15 of 15

Threaded View

  1. #7
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Any code sample using WDT please?

    I really need some help on this one. Does anybody have a code sample using Watchdog timer?

    I read the "Watchdog Timer Operation" datasheet, but it is still not very clear to me.

    Here is my piece of code (that works) when I don't use the WDTCON postscaler:
    Code:
    ' Fuses
    @ DEVICE PIC16F88,INTRC_OSC_NOCLKOUT,PROTECT_OFF,WDT_ON,PWRT_ON,MCLR_ON
    @ DEVICE PIC16F88,BOD_ON,LVP_OFF,CPD_OFF,DEBUG_OFF,CCPMX_OFF
    
    '-------------------------------------------------------------------------------
    ' Register settings
    OSCCON       = %01100000    'Internal RC set to 4MHZ
    ANSEL        = %00000000    'Disable Analogue Inputs
    OPTION_REG   = %00000111    'enable PORTB pullups, prescaler to WDT, rate 1:128
    'WDTCON       = %00000001    'Prescaler 1:32, WDT ON
    
    '-------------------------------------------------------------------------------
    ' Init
    LED1 var PORTB.0
    
    '-------------------------------------------------------------------------------
    ' Program
    MAIN:
        toggle LED1
        NAP 7
        goto main
    
    end
    If I use SLEEP instead of NAP, I can set up the sleeping time up to more than 18 hours.

    It looks as the pre- or postscaler don't affect the sleep period... (?)

    I'm completely lost....
    Last edited by flotulopex; - 4th January 2007 at 17:35.
    Roger

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. Replies: 5
    Last Post: - 24th February 2009, 18:55
  4. long countdown timer, how to save power?
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 15th November 2008, 05:15
  5. Long Timer
    By Tissy in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 1st November 2005, 17:24

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