Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : CPU SLEEP command...
Author | Message | ||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9066 |
Hi folks. I don't have any 170's to test the new CPU SLEEP command on, so can someone clarify for me: - The new CPU SLEEP command allows you to specify the time to sleep without needing external components. Therefore something like CPU SLEEP 15 will cause the uM to sleep for 15 seconds, then wake up. Used in a loop, this can be used to check the battery condition every 15 seconds kind of thing. While sleeping a preset time like this, can you still wake the uM up DURING a sleep cycle, in the same way as before, by changing the state of the WAKEUP pin, or does the new time period perimeter lock the uM in sleep for the specified time? Smoke makes things work. When the smoke gets out, it stops! |
||||
jimbotron Regular Member Joined: 27/11/2013 Location: AustraliaPosts: 46 |
That's right Grogster I haven't test the wake up pin but I have tested CPU SLEEP with minimal components connected and the timing seems to be accurate to within a few percent for a 1 hour sleep. Jimmy |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3165 |
At this time it is either sleep for a specified time or sleep while monitoring the wakeup pin - but not both at the same time. Geoff Graham - http://geoffg.net |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9066 |
Understood. Thanks. Smoke makes things work. When the smoke gets out, it stops! |
||||
jimbotron Regular Member Joined: 27/11/2013 Location: AustraliaPosts: 46 |
That's interesting Geoff, I had thought the wakeup pin would work with a time out as well, on rereading the manual entry again, I see that I made an assumption. I can see that being able to wake up from both would be very useful. From the "At this time" in your reply it sounds like you are considering it. I'd certainly vote for it. Jimmy |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9066 |
Me too, but it does not really bother me that much - I have designed for the external components, and my sleep times are not critical in any way, they just need to be in the area of what is wanted. A bit of variation in the actual sleep time does not matter in my application, so long as it is somewhere within the ballpark. Smoke makes things work. When the smoke gets out, it stops! |
||||
paceman Guru Joined: 07/10/2011 Location: AustraliaPosts: 1328 |
I was looking at the Manual this afternoon Geoff when Grogs brought this up and was a bit unsure myself. Probably worth adding your comment above to the definition. I haven't used this yet but I can see that being able to wake from both options would be useful. Greg |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3165 |
I think that what is needed is three modes; wake on change, wake on timeout and wake on either. The challenge is to think up a syntax that is logical and does not break older programs. Geoff Graham - http://geoffg.net |
||||
jimbotron Regular Member Joined: 27/11/2013 Location: AustraliaPosts: 46 |
How about: CPU SLEEP [SECONDS [,PIN]]
CPU SLEEP ' Wakeup on pin only CPU SLEEP 10 ' Wakeup on timer only CPU SLEEP 10, PIN ' Wakeup on pin or timer CPU SLEEP PIN ' Might also be allowed, but variable position parameters are not usual for BASIC. Existing code will continue to work as before. Jimmy |
||||
Print this page |