Difference between revisions of "Component: Timer (Timing)"
From Flowcode Help
Jump to navigationJump to searchLine 18: | Line 18: | ||
Library Version, Component Version, Date, Author, Info | Library Version, Component Version, Date, Author, Info | ||
+ | 18, 14.0, 07-02-25, BR, Hidden Postscaler property as it will cause issues with reported timings if used | ||
+ | 19, 14.0, 07-02-25, BR, Changed default to TMR0 with 1:1 prescaler | ||
+ | 20, 14.0, 07-02-25, BR, Added timer resolution property to show what resolution of timings can be acheived | ||
+ | 21, 14.0, 07-02-25, BR, Hidden some of the less useful properties from the user | ||
+ | 22, 14.0, 07-02-25, BR, Fixed a bug where the timer wouldn't correctly report the time when stopped | ||
Line 208: | Line 213: | ||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
| width="90%" | Prescaler | | width="90%" | Prescaler | ||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
Line 221: | Line 221: | ||
| colspan="2" | 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. | | colspan="2" | 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. | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9-type- | + | | width="10%" align="center" | [[File:Fc9-type-15-icon.png]] |
| width="90%" | Instruction Rate | | width="90%" | Instruction Rate | ||
|- | |- | ||
Line 227: | Line 227: | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]] | | width="10%" align="center" | [[File:Fc9-type-15-icon.png]] | ||
− | | width="90%" | | + | | width="90%" | Timer Resolution (ms) |
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]] | | width="10%" align="center" | [[File:Fc9-type-15-icon.png]] | ||
− | | width="90%" | Max Time Measurement | + | | width="90%" | Max Time Measurement (s) |
|- | |- | ||
| colspan="2" | Max time in seconds that we can measure before rolling over and starting again. | | colspan="2" | Max time in seconds that we can measure before rolling over and starting again. |
Latest revision as of 08:59, 9 June 2025
Author | Matrix TSL |
Version | 14.0 |
Category | Timing |
Contents
Timer 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.
Version information
Library Version, Component Version, Date, Author, Info 18, 14.0, 07-02-25, BR, Hidden Postscaler property as it will cause issues with reported timings if used 19, 14.0, 07-02-25, BR, Changed default to TMR0 with 1:1 prescaler 20, 14.0, 07-02-25, BR, Added timer resolution property to show what resolution of timings can be acheived 21, 14.0, 07-02-25, BR, Hidden some of the less useful properties from the user 22, 14.0, 07-02-25, BR, Fixed a bug where the timer wouldn't correctly report the time when stopped
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.
Macro reference
GetCountMicroSeconds
![]() |
GetCountMicroSeconds |
Returns the count value as a number of whole microseconds, rounded down to the nearest microsecond | |
![]() |
Return |
GetCountMilliseconds
![]() |
GetCountMilliseconds |
Returns the count value as a number of whole milliseconds, rounded down to the nearest millisecond | |
![]() |
Return |
GetCountReal
![]() |
GetCountReal |
Returns the count value as a floating point value in seconds. | |
![]() |
Return |
GetCountSeconds
![]() |
GetCountSeconds |
Returns the count value as a number of whole seconds, rounded down to the nearest second | |
![]() |
Return |
GetCountString
![]() |
GetCountString |
Returns the count value as a floating point string in seconds. | |
![]() |
Precision |
Number of decimal places to display in string | |
![]() |
Return |
GetRawCount
![]() |
GetRawCount |
Efficient command to collect the integer number of instructions since the timer was started. | |
![]() |
Return |
ResetCounter
![]() |
ResetCounter |
![]() |
Return |
StartCounter
![]() |
StartCounter |
Starts the timer counting. | |
![]() |
ResetCounters |
Range: 0-1 where 0=Do Not Reset and 1=Reset | |
![]() |
Return |
StopCounter
![]() |
StopCounter |
Stops the timer counting. | |
![]() |
Return |
Property reference
Component Source Code
Please click here to download the component source project: FC_Comp_Source_TimerComponent.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_TimerComponent.fcfx