Shop OBEX P1 Docs P2 Docs Learn Events
Pausing the Propeller — Parallax Forums

Pausing the Propeller

Eagle1Eagle1 Posts: 28
edited 2011-07-06 13:50 in Propeller 1
How do I pause a Propeller for long periods of time, e.g. 24 hours or longer? Thank you for your help in advance!
Eagle 1

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-07-06 13:50
    You create very long pauses by repeating shorter pauses. At 80MHz, the system clock (CNT) rolls over about every 50 seconds. I would suggest creating a 1 second clock using a WAITCNT( CLKFREQ + CNT). By repeating this 60 times, you get a 1 minute clock. By repeating that 60 times, you get a 1 hour clock, etc. The WAITCNT operation and the REPEATs take only a few microseconds to execute, so this overhead is a very small portion of the execution time that can even be corrected like this:
    pri wait24Hours | timeBase
    timeBase := cnt
    repeat 24   ' wait 24 hours
       repeat 60   ' wait 60 minutes
          repeat 60   ' wait 60 seconds
             waitcnt(timeBase += clkfreq)
    
    You can also use an external real time clock with an alarm output connected to a Propeller I/O pin, set an alarm for 24 hours or more ahead, and use WAITPEQ or WAITPNE to have the Propeller wait until the alarm output becomes active which will cause the wait to terminate. If you want, you can switch the Propeller to use the slow (32KHz) built-in RC clock before doing the wait. That will reduce the power consumption of the Propeller even further than when all cogs are waiting for something or stopped.
Sign In or Register to comment.