View Single Post
  #4   Spotlight this post!  
Unread 09-02-2004, 08:54
Chris Hibner's Avatar Unsung FIRST Hero
Chris Hibner Chris Hibner is offline
Eschewing Obfuscation Since 1990
AKA: Lars Kamen's Roadie
FRC #0051 (Wings of Fire)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1997
Location: Canton, MI
Posts: 1,488
Chris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond repute
Re: How to measure execution time? And code size?

Quote:
Originally Posted by gnormhurst
Can someone describe a simple way to measure how much of the 26 ms time budget is being used? As I add code I would like to know how close I am coming to the limit.

Also, how do I know how close I am to the memory limits for code and data?

Thanks all,
Norm
To measure the time, you should toggle a digital I/O pin every cycle. Then, hook an oscilliscope up to that pin. Using the scope, you can measure your timing very accurately.

Some example code (place this at the very beginning of your code):

static char TimingFlag;

if (TimingFlag)
TimingFlag = 0;
else
TimingFlag = 1;

Then immediately set the digital I/O pin equal to TimingFlag.

This code will produce a square wave on the scope. The time that the wave is high (or low) is your cycle time. I hope this helps.

-Chris
__________________
-
An ounce of perception is worth a pound of obscure.