View Full Version : PAUSE limitations

03-11-2010, 09:41 PM
I need to control two relays 8 hours apart. The max I can tell a PAUSE command to do is 56k or so.

Would it be possible to string together PAUSE commands to get me 8 hours?

For example:
PAUSE 60000
PAUSE 60000
PAUSE 60000
PAUSE 60000

repeat this until there are 480 PAUSE commands.


03-11-2010, 09:51 PM
i would use a count with the pause statement...
pause 1000
if i=28800 then timeout
else timer
i=0 'to reset timer
'what you want to do here

03-11-2010, 09:53 PM
Or, have one subroutine of say 1 minute duration. Then call it with a loop 480 times.

If you want to be able to use the Stamp for something else while waiting for 8 hours to elapse, make the subroutine much shorter, say 10 seconds and increase the number of loops accordingly. Note that doing a timing in this fashion is not very accurate.

If accuracy is needed, nothing beats a clock.


Tom Sisk


03-11-2010, 09:57 PM
Ok. I follow so far.

Here's my application. Maybe I only need one relay. I just will turn the relay on and off.

I will control a relay to turn lights on for 8 hours and off for 8 hours continuously.

With the timeout command mentioned above, won't that just reset everything. Sorry. It's been a few months since I've used my stamp.

Any code examples would be extremely helpful at this point.

03-11-2010, 10:10 PM
you could use the toggle command with the above code, like:
' {$STAMP BS2}
DIR2 = 1иииииииииииииииииииииииииииии ' pin 2 in output mode
OUT2 = 0ииииииииииииииииииииииииииии ' pin 2 output driver low dark for first 8 hrs, change to OUT2 = 1 for light for first 8 hrs
i VAR Word
иi = i+1
PAUSE 1000
IF i=28800 THEN timeout
GOTO timer
i=0 'to reset timer
TOGGLE 2 'this would toggle pin 2 every 8 hours
GOTO timer 'this tells it to go back to timing after toggling pin 2

Post Edited (kf4ixm) : 3/11/2010 3:24:23 PM GMT

03-11-2010, 10:41 PM
Perfect, thank you!

03-12-2010, 01:09 AM
Hey, that most be a very boring task for a BasicStamp. If you are going to control 110 or 220V AC why not use a Timer instead?