Is there a way to time total prgram execution time?
The Doctor
Posts: 37
For example, 20 mS seems to be a key time for servo control.· I have a program that checks various sensors, then sends a pulse to the servos to move the bot.· Since servos like a 20 mS cycle, I would like to know how long the program takes to execute, so I can add an appropriate Pause statement at the end of the code to make the total loop take 20mS to run.
In VBScript, you can simply echo the computer clock at the start and end of the routine, but there is no RTC on the BS2.· Is there a way to start some type of clock timer at the beginning of you code, then stop and echo the·timer value at the end?· Something like this:
Start timer at 0
Execute code
end timer
echo timer value to console
Any input you can provide would be appreciated.· Thanks!
In VBScript, you can simply echo the computer clock at the start and end of the routine, but there is no RTC on the BS2.· Is there a way to start some type of clock timer at the beginning of you code, then stop and echo the·timer value at the end?· Something like this:
Start timer at 0
Execute code
end timer
echo timer value to console
Any input you can provide would be appreciated.· Thanks!
Comments
-Phil
BTW, is there a way to interface a VBScript with the Stamp Editor?
If you have a second BASIC Stamp, use it as a pulsin timer.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
There are applications at this link already designed just for that purpose.
http://www.parallax.com/html_pages/downloads/software/software_basic_stamp.asp
Jeff T.
I've used the above methode to test instruction times, loop times and to determine scaling values between various speed Stamps (BS2, BS2p and BS2px).
Once you have one of these puppies, you'll find a lot of uses for it. It's a lot cheaper than an O-scope and for an amature like me it's a lot easier to use. The simple USB 2.0 interface and an excellent Windows GUI makes this a slam-dunk buy for Stamp users that need to dig deeper into their code performance than the DEBUG command allows.
Good luck, Steve