Difference between revisions of "Component: Timed Interval (Timing)"
Line 5: | Line 5: | ||
|- | |- | ||
| width="20%" style="color:gray;" | Version | | width="20%" style="color:gray;" | Version | ||
− | | 1. | + | | 1.2 |
|- | |- | ||
| width="20%" style="color:gray;" | Category | | width="20%" style="color:gray;" | Category | ||
Line 15: | Line 15: | ||
Allows you to setup a specific timed interval via the use of a hardware timer peripheral. Useful for regular time accurate periodic polling and sampling. | Allows you to setup a specific timed interval via the use of a hardware timer peripheral. Useful for regular time accurate periodic polling and sampling. | ||
− | == | + | ==Version information== |
− | |||
− | |||
− | + | Library Version, Component Version, Date, Author, Info | |
+ | 9, 1.2, 07-02-25, BR, Hidden Postscaler property as it causes a problem with timings if used | ||
==Detailed description== | ==Detailed description== | ||
Line 142: | Line 141: | ||
| 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" | Scaler applied to the timer, Small scalers allow for finer resolution but will limit the max time and also put more load on the microcontroller. Recommended to use as large a setting as possible which still provides enough accuracy. | | colspan="2" | Scaler applied to the timer, Small scalers allow for finer resolution but will limit the max time and also put more load on the microcontroller. Recommended to use as large a setting as possible which still provides enough accuracy. | ||
Line 159: | Line 153: | ||
| colspan="2" | 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. | | colspan="2" | 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. | ||
|} | |} | ||
+ | |||
+ | ==Component Source Code== | ||
+ | |||
+ | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_TimerIntervalComponent.fcfx FC_Comp_Source_TimerIntervalComponent.fcfx] | ||
+ | |||
+ | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_TimerIntervalComponent.fcfx FC_Comp_Source_TimerIntervalComponent.fcfx] |
Latest revision as of 08:59, 9 June 2025
Author | Matrix TSL |
Version | 1.2 |
Category | Timing |
Contents
Timed Interval component
Allows you to setup a specific timed interval via the use of a hardware timer peripheral. Useful for regular time accurate periodic polling and sampling.
Version information
Library Version, Component Version, Date, Author, Info 9, 1.2, 07-02-25, BR, Hidden Postscaler property as it causes a problem with timings if used
Detailed description
The Timed Interval component takes the headache out of setting up timer interrupts to interrupt an amount of fixed microseconds, milliseconds, seconds, minutes, hours or days.
After selecting the Time Unit, and entering Time Period, the estimated best will show the exact time the callback macro is accessed.
You can even send the required delay within simulation (Timer Delay (ms).
Unfortunately there is a small simulation only bug that is preventing the global variable within callback macro from updating, it all works on your embedded hardware.
The workaround (included within the example) for your own project is as follows.
First set up your timed interval component within properties along with the callback macro
Within the timed interval example, select the TimedInterval callback macro ,then select the Built-in Function::Debug.PrintLn(" ")
Right-click then select copy.
Paste the Built-in Function within the callback macro of your new project.
Now the interval timer component will simulate correctly.
Examples
Example program showing how to use the Timed component to trigger a callback macro at precise intervals e.g. 1 second.
One second timed interval component example
Macro reference
StartTimerInterval
![]() |
StartTimerInterval |
Starts the timer interval. | |
![]() |
Return |
StopTimerInterval
![]() |
StopTimerInterval |
Stops the timer interval. | |
![]() |
Return |
Property reference
Component Source Code
Please click here to download the component source project: FC_Comp_Source_TimerIntervalComponent.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_TimerIntervalComponent.fcfx