How to Measure Elapsed Time if Longer Than System Clock Loop
coryco2
Posts: 107
I am trying to set up a central "elapsed time" counter which methods in multiple cogs can all refer to. Easy enough, just write cnt to a global variable at the start and have the methods compare the current cnt at any given time to that value. But then how to handle when the system counter reaches its maximum value and loops around? I vaguely remember something to do with shifting bits to track a change like this, but the concept has escaped me. Can anyone point me in the right direction, please?
Comments
Jonathan
Why are you adding 500 in this line?
ms_clocks := (clkfreq + 500) / 1000
Does that make sense?
Jonathan