Jump to content

Component: Timer Free (Timing)

From Flowcode Help
Revision as of 14:13, 20 January 2023 by Wiki bot (talk | contribs)
Author Matrix TSL
Version 1.1
Category Timing


Timer Free component

Allows you to measure the passage of time via the use of a hardware timer peripheral. Works like a stopwatch with macros to start, stop and reset the timer counter. Returns time as integer Seconds, Milliseconds, Microseconds and also Floating Point and String.

Component Source Code

Please click here for the component source code: FC_Comp_Source_TimerComponentFree.fcfx

Detailed description

No detailed description exists yet for this component

Examples

Here is a basic example showing the operation of the timer component used to time a section of code or the duration of a specific event.

Timer Example

Macro reference

GetCountSeconds
Returns the count value as a number of whole seconds, rounded down to the nearest second 
- ULONG Return


StartCounter
Starts the timer counting. 
- BOOL ResetCounters
Range: 0-1 where 0=Do Not Reset and 1=Reset 
- VOID Return


GetCountString
Returns the count value as a floating point string in seconds. 
- BYTE Precision
Number of decimal places to display in string 
- STRING Return


GetCountMicroSeconds
Returns the count value as a number of whole microseconds, rounded down to the nearest microsecond 
- ULONG Return


GetCountMilliseconds
Returns the count value as a number of whole milliseconds, rounded down to the nearest millisecond 
- ULONG Return


StopCounter
Stops the timer counting. 
- VOID Return


ResetCounter
 
- VOID Return


GetCountReal
Returns the count value as a floating point value in seconds. 
- FLOAT Return


GetRawCount
 
- ULONG Return



Property reference

Properties
Timer
Timer Peripheral to use to monitor the passage of time. 
Bit Depth
Number of bits in the timer peripheral. 8-bit timers can count from 0-255 before overflowing. 16-bit timers can count from 0 to 65535 before overflowing. 
Instruction Rate
 
Rollover Frequency
 
Rollover Time
 
Max Time Measurement
Max time in seconds that we can measure before rolling over and starting again. 
Simulation
Timer Delay (ms)
Number of milliseconds between timer events which increment the simulated timer counter variable. 10ms will yield the highest resolution. Values less than this will likely just increase the error and making the timer run slow. Higher delays will yield greater accuracy. 
Decimal Points