Difference between revisions of "Component: Timed Interval (Timing)"
Line 57: | Line 57: | ||
Example program showing how to use the Timed component to trigger a callback macro at precise intervals e.g. 1 second. | Example program showing how to use the Timed component to trigger a callback macro at precise intervals e.g. 1 second. | ||
− | {{Fcfile|Timed_interval_example.fcfx| | + | {{Fcfile|Timed_interval_example.fcfx|One second timed interval component example }} |
==Macro reference== | ==Macro reference== |
Latest revision as of 12:20, 24 January 2025
Author | Matrix TSL |
Version | 1.1 |
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.
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
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 |