How Can We Help?


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

With HMI-Tool

In the Macro Editor, add a new macro and copy it.

#include "MacroInit.h"
void Macro_main(IN *p)
if (LocalWord[10000]>0)
LocalWord[10000]--; // Decrement -1
if (LocalWord[10000]==0)

Add the macro in “global Macro” list

And set its execution frequency to 1000 ms (1 second) to decrement the LocalWord[10000] every 1000 ms.


Try it!

You can download the example: Timer-Countdown