NAP vs. SLEEP


Closed Thread
Results 1 to 5 of 5

Thread: NAP vs. SLEEP

  1. #1
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305

    Default NAP vs. SLEEP

    Is the major/only difference between NAP and SLEEP the time during which the processor is powered down?

    I'm using a 12F683 and the data sheet only describes SLEEP. The PBPRO manual adds "short " to the description of NAP so I'm inclined to think the only difference is the time in which the processor is powered down.

    I'm ready to get schooled.

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: NAP vs. SLEEP

    NAP puts the PIC to sleep for ONE watchdog timer period.
    This is similar to the PIC's SLEEP instruction except that NAP sets the watchdog period first.
    Depending on the PIC being used, periods are ~18mS or greater per NAP.

    SLEEP uses multiple WDT periods, and approximates the requested time to 1 second resolution.
    Thousands of WDT periods may be required, depending on the requested SLEEP time.
    On each WDT timeout, the PIC wakes up ... checks to see if the SLEEP time is complete ... if not it decrements a counter and goes back to sleep again.
    DT

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: NAP vs. SLEEP

    Ugh, Darrel,
    the sleep you refer to is PBP sleep correct?
    Would you please explain how @ SLEEP works if it is different?
    Thank You
    JS

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: NAP vs. SLEEP

    @ SLEEP is used by both of the PBP commands NAP and SLEEP.
    It is the ASM instruction that puts the PIC into Low Power Mode.

    NAP and SLEEP have additional code to control the amount of time the PIC is in that mode by setting the WDT period and counting its timeouts.
    If the WDT is disabled, @ SLEEP and NAP are functionally the same, and the PIC will remain in L.P. mode untill an interrupt wakes it.
    DT

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: NAP vs. SLEEP

    Thank You ! That is what I was unsure about.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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