Time for running a program
Hi,
Can i ask how·can i get the information of how much time is used to run the whole program?
Thanks in advance!![smilewinkgrin.gif](http://forums.parallax.com/images/smilies/smilewinkgrin.gif)
Kevin
Can i ask how·can i get the information of how much time is used to run the whole program?
Thanks in advance!
![smilewinkgrin.gif](http://forums.parallax.com/images/smilies/smilewinkgrin.gif)
Kevin
Comments
·
·· Without knowing the nature of the program that would be hard to answer.· Most programs on an embedded controller never end.· They continuously run in a loop so there is no end, per se. ·If you have a very short program that runs a calculation, you could gauge time by making a pin go HIGH, then at the end of the program LOW and see this on a scope.· If the program runs for more than a few mS though you would probably need an RTC.· It really depends on the program.· What does it do?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Also, you can use StampPlot (lite or Pro) to send a byte of data ( DEBUG DEC 0,CR), and have it log the time to hundreths of second. Then look at the logs to see the interval between them.
Counting instructions doesn't work because each instruction takes a different amount of time. This isn't assembler [noparse]:)[/noparse]
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Martin Hebel
StampPlot - Graphical Data Acquisition and Control
AppBee -·2.4GHz Wireless Adapters & transceivers·for the BASIC Stamp & Other controllers·
My program·should be·running in loops continuously. I need the information of the time needed to run one single loop so that i can get its frequency. What the program will do is it will obtain sensor data and do calculations and output a 6-channel PWM to a transmitter via trainer port to control a remote control car. I can foresee that my entire program will hav more than 50 lines of instructions. As i know,·duration·of a·PWM is about 20ms, each pulse varies from 1-2ms. Has anyone foresee any problem, e.g. the·signal·update rate? Please let me noe your valuable opinions, any comments or opinions or ideas are most welcomed!!
Kevin
Thanks in advance!!
Kevin
Martan has given you the best answers available just above. Short of doing it by that fairly exacting method, I suppose you could estimate it if you wanted to go through the time and trouble of examining exery instruction that gets executed, and sum all of the individual instruction times used in the loop(s).
Martin's method is far more exacting, and permits simple re-measurment if the program changes any.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->