Quote Originally Posted by Ioannis View Post
What are the 10000 and 8 stand for in the equation?
The 10000 comes from the fact that the intr code is assuming a 100Hz interrupt (MHz -> 100Hz = 10000),
and the 8 is an attempt to compensate for the number of instruction cycles it takes to reload the timer.

Demon -
How long of a time period are you looking to measure?
If you can live with 65536 counts (the 16-bit timer count) then you can just drop all the interrupt code, let the timer free-run, and just subtract two unsigned timer values... something like this:
Code:
start_time = readtimer()
'code you wish to time is here
elapsed_time = readtimer() - start_time