Precision NAP or SLEEP


+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2013
    Posts
    28

    Default Precision NAP or SLEEP

    I would like to NAP or SLEEP to save power but need to wake up precisely after a random delay. (Yes, that's rather contrary.) I am computing the delay no problem and storing it in a 8Bit variable "Xwait" which is between 67mS to 200mS. I would like to feed the equivalent of NAP or SLEEP with this variable. All I/O is disabled during this period and the uC is a 16F684 using it's 4MHz internal oscillator. 1mS resolution would be great, but as much as 10mS would be acceptable. Setting a timer would be ok as well if NAP or SLEEP are unworkable.(This pseudo random repeat wake-up delay is used to avoid collisions between multiple transmitters.)

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,356

    Default Re: Precision NAP or SLEEP

    Hi,
    Both NAP and SLEEP uses the wathcdog timer of the PIC so the accuracy depends on the accuracy of the watchdog timer oscillator - a figure you should be able to find in the datasheet for the PIC.

    SLEEP is programmed in units of seconds so it won't work for you.
    NAP can be set to either 18, 36, 72, 144, 288ms and so on so it probably won't work either.

    Timers are usually clocked by the main oscillator which is shut down when you put the PIC into sleep.

    You probably need to run a timer with an external x-tal or oscillator in order to keep it running when you power down the actual core.

    /Henrik.

Similar Threads

  1. NAP vs. SLEEP
    By AvionicsMaster1 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 8th August 2011, 19:47
  2. Nap and sleep commands
    By rusty99 in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 27th August 2010, 08:16
  3. Sleep & nap
    By keymuu in forum mel PIC BASIC Pro
    Replies: 24
    Last Post: - 4th December 2008, 18:45
  4. Sleep/Nap Low power consumption
    By George in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th March 2007, 06:19
  5. Replies: 5
    Last Post: - 5th February 2006, 16:51

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