• AVR Freaks

Hot!Long term sleep/wake methods

Author
fsonnichsen
Super Member
  • Total Posts : 256
  • Reward points : 0
  • Joined: 2009/08/13 11:00:11
  • Location: 0
  • Status: offline
2020/01/21 18:46:28 (permalink)
0

Long term sleep/wake methods

In the past I have used an external RTC IC/alarm setup to wake a PIC from deep sleep after periods of an hour or longer. I am redesigning some old circuits and wondered if there was a better way now using the internal RTCC feature of some PICs. 
   I know there a few ways to do sleep/wake with the WDT but this only allows time cycles in seconds and the code needs to be cobbled to count several wake ups or some other method to reach cycles in the hours.
   Is there a white paper buried in here somewhere discussing long sleep-wake up methods for the PIC?
 
thanks
fritz
#1

8 Replies Related Threads

    NKurzman
    A Guy on the Net
    • Total Posts : 18245
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Long term sleep/wake methods 2020/01/21 19:03:46 (permalink)
    +2 (2)
    The WDT wake up is not accurate enough to measure time.  Unless you do not care about accuracy.
    Some WDTs will do minutes.
     
    What Family of PIC are you thinking 8 bit, or more?
    #2
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11567
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: Long term sleep/wake methods 2020/01/21 19:57:47 (permalink)
    +1 (1)
    using the internal RTCC feature of some PICs.

     
    You're going to have a very small selection of PICs if you want to have an internal RTCC.
     
    code needs to be cobbled to count several wake ups or some other method to reach cycles in the hours.

     
    There are PICs that have daisy-chainable timers that will let you measure any amount of time.  Some have an internal 32k clock for low power, or you can use an external 32k crystal.
    #3
    fsonnichsen
    Super Member
    • Total Posts : 256
    • Reward points : 0
    • Joined: 2009/08/13 11:00:11
    • Location: 0
    • Status: offline
    Re: Long term sleep/wake methods 2020/01/21 20:26:00 (permalink)
    0
    I thought the 8 bit would suffice for this simple task but I could go to a PIC24, The only thing it is doing  is just powering up the system periodically. I do not have a grasp on the accuracy of the WDT. I guess in cannot be clocked from and external crystal?
      I agree there are very few RTCC PIC versions. By daisy chaining I assume you mean chaining TMR clocks? But I think these do not function during low power sleep modes.
     
    thanks
    fritz
    #4
    piticbogdan
    New Member
    • Total Posts : 14
    • Reward points : 0
    • Joined: 2018/12/02 17:58:02
    • Location: 0
    • Status: online
    Re: Long term sleep/wake methods 2020/01/21 20:52:12 (permalink)
    0
    If the low power is a priority I think the external RTC should be considered
    #5
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11567
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: Long term sleep/wake methods 2020/01/21 21:46:24 (permalink)
    +1 (1)
    I do not have a grasp on the accuracy of the WDT. I guess in cannot be clocked from and external crystal?

     
    It is very low accuracy.  There are much more flexible timers that can be clocked externally.
     
    By daisy chaining I assume you mean chaining TMR clocks?

     
    Yes.
     
    But I think these do not function during low power sleep modes.

     
    They function as long as you provide a clock to them, regardless of sleep.  Look at the PIC16F18855 as an example.
    #6
    dilawar
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2019/04/25 12:39:02
    • Location: 0
    • Status: offline
    Re: Long term sleep/wake methods 2020/01/22 08:36:51 (permalink)
    0
     some pics like pic16f887 has the feature to use external resistor and capacitor to wake up the pic after long period of sleeping. the duration of sleeping is determined by the product of 'R' and 'C'.
    here below paragrph is taken from data sheet of pic16f887.
     
    The Ultra Low-Power Wake-up (ULPWU) on RA0 allows a slow falling voltage to generate an interrupt-on-change on RA0 without excess current consumption. The mode is selected by setting the ULPWUE bit of the PCON register. This enables a small current sink, which can be used to discharge a capacitor on RA0. Follow these steps to use this feature: a) Charge the capacitor on RA0 by configuring the RA0 pin to output (= 1). b) Configure RA0 as an input. c) Set the ULPWUIE bit of the PIE2 register to enable interrupt. d) Set the ULPWUE bit of the PCON register to begin the capacitor discharge. e) Execute a SLEEP instruction. When the voltage on RA0 drops below VIL, an interrupt will be generated which will cause the device to wake-up and execute the next instruction. If the GIE bit of the INTCON register is set, the device will then call the interrupt vector (0004h). This feature provides a low-power technique for periodically waking up the device from Sleep. The time-out is dependent on the discharge time of the RC circuit on RA0. 
    #7
    Mysil
    Super Member
    • Total Posts : 3619
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: Long term sleep/wake methods 2020/01/22 11:15:46 (permalink)
    0
    Hi,
    Those PIC devices that have RTCC hardware.
    These are many PIC24 and dsPIC33 with RTCC with RTCC peripheral,
    All PIC32 devices, including PIC32MM have RTC with alarm settings for days or weeks or months in the future.
     
    But this is PIC10, PIC12, PIC16 ... forum,
    and among PIC18 devices, there are only very few devices in ___K22...  and __K90... families in 64 pin or larger,
    that have RTCC peripheral.
     
        Mysil
    #8
    ric
    Super Member
    • Total Posts : 25502
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Long term sleep/wake methods 2020/01/22 15:45:52 (permalink)
    0
    dilawar
     some pics like pic16f887 has the feature to use external resistor and capacitor to wake up the pic after long period of sleeping.
    ...

    Thanks, I was trying to remember the name of that feature.
    Only a limited range of PIC16F devices have that feature
    631, 636, 639, 677, 684, 685, 687, 688, 689, 690, 882, 883, 884, 886, 887
    none of the "enhanced" midrange PICs do (PIC16F1xxx and PIC16F1xxxx). I don't know if they have something equivalent under a different name.
    A number of PIC18F devices have it.
     
    Again, this will give you a very long pause in sleep, but it's not accurate at all.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #9
    Jump to:
    © 2020 APG vNext Commercial Version 4.5