Page 1 of 1

Timing code

Posted: Sun Feb 10, 2013 9:17 pm
by YahooArchive
>1. Can I expect a given set of code to consistently take a fixed amount of time
to execute each and every time it executes? If so, can I use the TIMER command
in between the code to be executed to estimate the execution time, and then use
the WAIT command to wait the required amount of time to achieve a desired loop

Timing code works if there are no interrupts going on, but in the ARM code
timing can vary due to position in Flash because of the memory accelerator.
What this means is that one piece of code in Flash will execute the same each
time, but when you recompile it, it may execute faster or slower because it
moved in Flash. Why not just use the TIMER to set timing, its accurate to 1 uS