How to setup a timer/countdown inside the HMI with a macro
In this post, we will show you how to add a simple timer/counter/countdown in the HMI using a macro.
- Have the possibility of start a counter that will decrement on activation of a bit
- Via a setpoint word, have the possibility of changing the starting value to be decremented (40 sec, 60 sec…)
- Once the counter has reached zero, a bit will be set
In the Macro Editor, add a new macro and copy it.
void Macro_main(IN *p)
LocalWord--; // Decrement -1
Add the macro in “global Macro” list
And set its execution frequency to 1000 ms (1 second) to decrement the LocalWord every 1000 ms.
You can download the example: Timer-Countdown