How do you run a background timer?
Magnets
Posts: 2
I'm relatively new to the BASIC language so this might be a problem in not knowing enough commands. I need to start a timer that when started from one point in the program can count up from zero while the program goes on and does whatever else it needs to do. Each time control passes by a particular part of the code it should be able to check to see if the timer is greater than of equal to a time value and then if so reset the timer and make it able to start again, while if not then going on and checking later, when it eventually gets back to the part where it starts the timer.
Just as clarification I know how to do an if . . . else statement. I just can't make a timer that doesn't require continuous command to save my life, one that can be run in the background of the rest of the program.
Thanks to anyone who can help
Just as clarification I know how to do an if . . . else statement. I just can't make a timer that doesn't require continuous command to save my life, one that can be run in the background of the rest of the program.
Thanks to anyone who can help
Comments
To get around it you can add an external timing device and then refer to it at times during your program.
If you have the Basic Stamp that has the inbuilt I2C commands then a I2C RTC/Timer like the PCF8563 would do.
If you don't have the Basic Stamp with I2C commands then you can use a serial RTC device like the DS-1302 that is sold by Parallax (Product ID 604-00005)
See this thread:
http://forums.parallax.com/showthread.php/82908-I2C-On-A-BASIC-Stamp?p=567240&viewfull=1#post567240
I would second Beau's advice:
Speaking of which, you might want to read a suggestion by Phil Pilgrim (one of the forum's smart guys). (See post #29)
If you take Phil's advice, there are lots of us willing to help. There are also lots willing to help if you prefer your cozy straitjacket.
In case you're interested, I have links to tutorials in post #3 of my index (see signature). I hope you checkout some of my projects listed in post #2 while you're there.
Even though I didn't explicitly say the phase "YRSUTTP" I doubt I'll completely escape erco's wrath.
-Phil
Heck, I may have to do this just for fun.
That's so last decade. Try to keep up with the current state of the art.
Oh, no. I think that was another YRSUTTP comment in the Basic Stamp forum. I claim entrapment.