How to Pause the process for 45 minutes?
Camaney
Posts: 16
I am using the latest version of SX/B with SX28 chips.
I am trying to create an alert of blinking LEDs every 45 minutes, but so far I haven't been able to PAUSE for that amount of time.
I am using the following comand:
PAUSE 2700000
based on 1000 = one second.
Can someone tell me what I am doing wrong?
Thanks.
I am trying to create an alert of blinking LEDs every 45 minutes, but so far I haven't been able to PAUSE for that amount of time.
I am using the following comand:
PAUSE 2700000
based on 1000 = one second.
Can someone tell me what I am doing wrong?
Thanks.
Comments
RS_JIM
An alternative to the loops RS Jim mentioned, another way to do this is to set a variable to the current clock count + the number of ticks you need for your "delay" time. Then have a loop that does your other stuff, or checks for inputs, etc., and part of that loop does a compare to see if the count is >= your setting. If it is, do your thing, if not, repeat the loop.
I'm not an expert by any means, but you may also be able to look at the "sleep" function. Is there a way you could externally trigger a "wake up call" (maybe a 555 timer).
Another possibility is to incorporate a real time clock (RTC), and do a comparison based on the actual time.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John R.
Click here to see my Nomad Build Log
If you want to minimize power. Then you could use SLEEP with a WATCHDOG wakeup.
Basically, set the watchdog to it's maximum timeout (about 2.3 Seconds). When the program wakes-up it will increament a counter. When the counter reaches 1174 (45*60 / 2.3), then blink the LEDs.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
Post Edited (Bean (Hitt Consulting)) : 6/11/2009 5:22:51 PM GMT
Bean, I tried your code but when I run it tells me that _TO is not defined.
Any thoughts?
Thanks again.
· Make sure you have the latest version of the compiler.
· You can get it from here http://forums.parallax.com/showthread.php?p=780347
· Download the zip file, extract the files and copy them to C:\Program Files\Parallax Inc\SX-Key v3.2.92\Compilers\SXB
· Overwrite the existing files when asked.
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
Post Edited (Bean (Hitt Consulting)) : 6/12/2009 2:01:27 AM GMT
For the sake of practicing and learning I also Tried RS_Jim suggestion and it did worked too. Thanks.
I also wanted to try John R. suggestion but I am not that knowledgeable yet; '...set a variable to the current clock count + the number of ticks you need for your "delay" time.'
Thank you all for your input, as I progress in my learning curve I am sure I will ask you again for help.
This will NOT change the watchdog timeout because the watchdog runs from it's own oscillator.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
·
Ideas are welcome.
Thanks.
Something to think about anyway.
Hope it helps.