Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 23:06 02 May 2024 Privacy Policy
Jump to

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 Zealand
Posts: 9066
Posted: 04:37pm 18 Nov 2014
Copy link to clipboard 
Print this post

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?

Edited by Grogster 2014-11-20
Smoke makes things work. When the smoke gets out, it stops!
 
jimbotron
Regular Member

Joined: 27/11/2013
Location: Australia
Posts: 46
Posted: 04:56pm 18 Nov 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 3165
Posted: 08:41pm 18 Nov 2014
Copy link to clipboard 
Print this post

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 Zealand
Posts: 9066
Posted: 08:55pm 18 Nov 2014
Copy link to clipboard 
Print this post

Understood. Thanks.
Smoke makes things work. When the smoke gets out, it stops!
 
jimbotron
Regular Member

Joined: 27/11/2013
Location: Australia
Posts: 46
Posted: 09:10pm 18 Nov 2014
Copy link to clipboard 
Print this post

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 Zealand
Posts: 9066
Posted: 09:28pm 18 Nov 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 1328
Posted: 01:31am 19 Nov 2014
Copy link to clipboard 
Print this post


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: Australia
Posts: 3165
Posted: 03:25am 19 Nov 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 46
Posted: 03:55am 19 Nov 2014
Copy link to clipboard 
Print this post

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


To reply to this topic, you need to log in.

© JAQ Software 2024