Skip to content
English
  • There are no suggestions because the search field is empty.

How to create an arithmetic 1Hz counter

How to create a variable that increments every second that can be manually triggered and reset.

We can use the Integrator arithmetic function to monitor a value being triggered, then integrate that over time to create a 1Hz incremental counter.

    1. Create 3 new virtual variables (can name as desired)
      1. Setpoint: Counter_start
      2. Setpoint: Counter_reset
      3. Arithmetic: Counter
    2. For the arithmetic variable Counter, edit the formula
      1. Integrator(Higher(“Counter_start”;0.5))
    3. In the arithmetic variable still, go to the Reset section. Check the box for Reset on variable and select the Counter_reset variable. Click OK to save changes.
    4. Make sure new variables are added to SystemDataStream. Write changes to the controller.

Now when Counter_start variable goes to 1, it will start the 1Hz counter. Set Counter_start to 0 to pause the count. Set Counter_reset to 1 at any time to reset Counter to 0.