clarification of SLEEP command?

Closed Thread
Results 1 to 2 of 2
  1. #1

    Default clarification of SLEEP command?

    <edit> - found this answered more or less elsewhere - no precision, it's WDT based.

    In the manual, it states that the SLEEP Period command puts the uC in low power mode for Period seconds, BUT it wakes up "periodically" using the WDT and the internal RC clock, to CHECK and see if time is up.

    My question is, does it use the WDT for counting ticks while "sleeping", or does it use its defined OSC for doing that part while sitting there doing nothing else? I understand the concept of it waking up now and then to check, but... is the periodic waking up cycle actually doing the counting itself, or is the uC doing the counting with the high precision OSC while in "sleep" mode?

    I have used NAP, but it seems to be quite a different animal, from the descriptions. I want something that puts the chip into low power for a certain period of time (i.e. - 12 hours) with precision (within 2 seconds is fine).


    Last edited by picster; - 4th May 2023 at 20:28.

  2. #2
    Join Date
    Apr 2014

    Did you find this post helpful? Yes | No

    Default Re: clarification of SLEEP command?

    The High Speed Oscillator is shut down in SLEEP Mode, therefore the WDT relies on the 32 kHz LFINTOSC. This can be internal or external. You didn't mention which PIC you're using, but the WDT will have scalers (Pre- or Post-) to divide the 32 kHz for longer durations. The more clock divisions, the less precision you can achieve. You may need to create a Variable that can be incremented each time the WDT wakes the PIC from SLEEP. When the Variable reaches a predetermined value (equating to your 12 hours), you then go to your MAIN Function and do some work. Some PICs will allow you to achieve 12 hours in a single session. The Data Sheet will give you the details for your chosen PIC.

Similar Threads

  1. Status after @ SLEEP Command
    By sayzer in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 17th June 2011, 14:10
  2. Sleep Command
    By thye in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 27th October 2007, 15:28
  3. Help with PBP 'SLEEP' command
    By dreadmaul in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th November 2006, 07:40
  4. Using Sleep command
    By suded in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 8th April 2005, 04:16
  5. Sleep command with 18F1220
    By suded in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 7th April 2005, 11:11

Members who have read this thread : 1

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

Tags for this Thread

Posting Permissions

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