MotoHawk Free Running Timer: Difference between revisions

From NewEagleWiki
Jump to navigation Jump to search
(Created page with 'The Free Running Timer is a way to access the 32 bit system clock. The attached model uses an internal API (Timer_FreeRunningCoutner_Get32Bits()) and loads the result into a Moto…')
 
No edit summary
Line 5: Line 5:


Abs_Time_Value 2023331
Abs_Time_Value 2023331
Abs_Time_Value_Delta 5001
Abs_Time_Value_Delta 5001
Faster_FreeRunning_Time_Value 28963072
Faster_FreeRunning_Time_Value 28963072
Faster_FreeRunning_Time_Value_Delta 5000
Faster_FreeRunning_Time_Value_Delta 5000
SystemClockTicks 2317445755
SystemClockTicks 2317445755

Revision as of 18:22, 19 December 2011

The Free Running Timer is a way to access the 32 bit system clock. The attached model uses an internal API (Timer_FreeRunningCoutner_Get32Bits()) and loads the result into a MotoHawk Data Store. There are two things to keep in mind: the system clock tick will roll over faster than the max size of a 32 bit integer, so the value will never count as high as 0xFFFFFFFF micro-seconds. Secondly, no protection for roll over is implied in this sample, so that should be taken into account if you would like to use this mechanism.

The reason to use code instead of MotoHawk_Abs_Time lock is it allows a 10X speed increase (17µsec/call --> now 1.5 µsec/call). It saves 1ms execution time with 80 instances in a model. Here is a sample of the VarDecs you see in MotoTune from this model:

Abs_Time_Value 2023331

Abs_Time_Value_Delta 5001

Faster_FreeRunning_Time_Value 28963072

Faster_FreeRunning_Time_Value_Delta 5000

SystemClockTicks 2317445755