Counter Module

The Counter module provides a facility to count how many times a certain event occurs. It increases or decreases its output by a specified amount every time it is triggered.

Module icon


NOTE: The registers and settings available in this module depend on the device or node you are configuring, as well as its firmware and template versions. Not all registers or settings are available on all devices or the Virtual Processor, and labels may vary.



When this input receives a pulse, it either increases or decreases the number in the Accumulatr output register by an amount defined by the Multiplier setup register. Linking this input is mandatory.


When this input is ON, the module is enabled; when it is set to OFF, the module is disabled, counting stops, and the Accumulatr output register retains the last value it received. This input is optional; if you leave it unlinked, the module will be enabled by default.


When this input receives a pulse, it resets the Counter module, and sets the Accumulatr output register to the value in the Preset setup register. Linking this input is optional; the module will still operate if you leave this input unlinked.

NOTE: The Reset input will still function if the module’s Enable input is OFF.
When the module receives simultaneous reset and count pulses, the module resets before counting.

Setup registers

The Counter module setup registers define the magnitude, direction and update rate of the count.


This register specifies the amount to increase (or decrease) the output for every incoming count. By default, Multiplier is set to ONE.

Count Mode

This register determines if the module increments or decrements the value in the output register. Select UP to set the mode to increasing value (count up) and DOWN to set the mode to decreasing value (count down). By default, Count Mode is set to UP.


This register specifies what value the Accumulatr output register should be reset to in the event of a reset pulse or rollover. (A rollover occurs when the Accumulatr output reaches the value specified in the RollValue setup register.) By default, the Preset register is set to zero.

NOTE: The Accumulatr output will be set to the value in the Preset setup register at startup

RollValue (rollover value)

When the Accumulatr output register reaches the value specified by the RollValue setup register, the Result output register will be reset to the value in the Preset setup register. Setting this register to zero disables the Rollover feature (no rollovers will occur). By default, this register is set to zero.

Update Rate

This enumerated register defines how frequently the Accumulatr output register is updated (one second or high-speed/half-cycle).

Output registers

Accumulatr (accumulator)

This numeric variable register contains the accumulated count. Highest count (up or down) is ±1 x 1099. See note in “Detailed Module Operation” section.


This register generates a pulse every time the Accumulatr output reaches the value specified in the RollValue setup register.


All events are recorded in the Event register. Possible events and their associated priority numbers are:

Event priority group Priority Description
Reset 5 A module reset has occurred.
Setup Change 10 Input links, setup registers or labels have changed

The Event output register stores the following information for each ION event: time stamp, priority, cause, effect, and any values or conditions associated with the cause and effect.

Detailed module operation

When a pulse is received on the Count input, the Counter module updates the Accumulatr output register by the amount defined in the setup registers. The Rollover output will send a pulse when the Accumulatr output value reaches RollValue setup register value.

NOTE: The module updates the Accumulatr output register every time the Count input is pulsed, up to a value of 16,777,216. It is therefore recommended that the Roll Value register be set below 16,777,216.

The figures below illustrate the operation of a Counter module. These examples indicate how the setup registers affect what value is written in the Accumulatr output register, and when Rollover pulses are sent.

Example 1 — Standard operation

Note that the value at the Accumulatr output never actually reaches the RollValue; instead, when RollValue is reached, the output jumps to the Preset value. The Rollover pulse is sent the instant the Preset value is written into the Accumulatr output.

Example 2 — Overshooting the RollValue

The module’s operation must be considered carefully if the range defined by Preset and RollValue registers is not directly divisible by the Multiplier value. This type of configuration will cause the RollValue to be “overshot”.

As shown above, the Accumulatr does not lose counts if the RollValue is overshot. Instead, when the count goes above the RollValue, the amount of the overshoot (the remainder) is added to the Preset value and the Accumulatr value is updated. The Rollover pulse is sent when the Preset + remainder value is written into the Accumulatr output.

Example 3 — Count-to-Zero

Note that the RollValue is set to –1 to create a count-to-zero function.

Responses to special conditions

Optional section

The following table summarizes how the module behaves under different conditions.

Condition Response of output registers
After the module is re-linked or its setup registers are changed The Accumulatr output register value is set to the Preset setup register value.
When the device is started or powered-up (either the first time, or after a shut-down) The Accumulatr output register retains the value it held at shutdown.

Illegal Counter Setup Values

Some combinations of setup register values constitute illegal setups. If the Counter module is setup with illegal values, the module will not go online when the device starts up. Illegal setup combinations are as follows:

  1. The Multiplier setup register cannot be set to zero.

  2. The module will not operate if Preset equals RollValue (unless both registers are set to zero, disabling rollover)

  3. The Multiplier value must be smaller than the absolute value of the Preset value minus the RollValue. If the Multiplier were larger than the range between Preset and RollValue, rollover would occur with every count.

  4. The count must always move towards the RollValue, unless RollValue is set to zero. Any combination of setup register values that cause the module to count away from the RollValue are not permitted.

QR code for this page

Was this helpful?