Shop OBEX P1 Docs P2 Docs Learn Events
Referencing Timing — Parallax Forums

Referencing Timing

clloydclloyd Posts: 31
edited 2008-10-24 04:43 in BASIC Stamp
Is there any way to count the instructions that are being executed by a certain code? I am trying to see how long it takes to run the code in order to set up some timing functions so if there is anyway to see how many cycles are being run, help would be greatly appreciated!

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-24 04:43
    Have a look at Tracy Allen's website (www.emesystems.com). At the bottom of the main page, click on "app-notes". There's a section on Stamp Basic statement timing. That's pretty much the best there is. I believe he discusses how he did this. One way you can easily do is to take the code you're interested in and execute it repeatedly (if possible). You might put a FOR NEXT loop around it with a count of 100 or 1000 and use a DEBUG statement to display a message at the beginning and the end of the loop. You can time the messages with a stopwatch to get the overall time and divide by the loop count.
Sign In or Register to comment.