Project

General

Profile

Actions

Counter Input

Overview

A Counter Input keeps a running count that goes up and down as trigger
inputs fire. Three inputs drive it: one increments, one decrements, and one
resets it. Use it to tally events — shift counts, button presses, fault
occurrences — or to maintain a step value you nudge up and down.

Prerequisites & hardware

You need up to three trigger inputs, each referenced by alias:

  • An up input that increments the count.
  • A down input that decrements it.
  • A reset input that reloads the reset value.

Triggers are typically boolean signals such as a Compare Input
or a Digital Input; the counter steps on each trigger edge.
Any trigger you do not need can be left unset.

Add it in the app

  1. Add a new input and choose Counter Input as the type.
  2. Choose the up / down / reset trigger inputs.
  3. Give it a clear alias (e.g. Shift Count).
  4. Set the step, the min / max limits, the start and reset
    values, and whether the count rolls over.

Settings reference

Setting Meaning Unit Range / values Notes
Up input Trigger that increments the count an existing input (by alias) Counts up by Step on each edge.
Down input Trigger that decrements the count an existing input (by alias) Counts down by Step on each edge.
Reset input Trigger that reloads Reset value an existing input (by alias) When it fires, the count jumps to Reset value.
Step Amount added/subtracted per trigger count int32 The increment size. Usually 1.
Min value Lowest the count may reach count int32 Clamp limit (see Rollover).
Max value Highest the count may reach count int32 Clamp limit (see Rollover).
Start value Count at power-up count int32 The value loaded when the controller starts.
Reset value Value loaded on reset count int32 What the count becomes when the reset input fires.
Rollover Wrap around the limits instead of clamping on / off On: counting past Max wraps to Min (and below Min wraps to Max). Off: the count stops at the limit.

Edge triggering: the count changes once per trigger event, not continuously
while a trigger is held. At the limits, Rollover decides between wrapping and
clamping.

Common settings

Counter Input also uses the shared setting — alias. See Common IO Settings.

Example — count gear shifts

  1. Type Counter Input, alias Shift Count.
  2. Up input = a Compare Input that fires on each shift.
  3. Reset input = a Trip Reset button input.
  4. Step 1, Start value 0, Reset value 0.
  5. Min 0, Max 999999, Rollover off so it simply tallies up until
    reset.

Troubleshooting

  • Count never changes: check the trigger inputs actually toggle and that Up
    / Down
    are assigned.
  • Counts more than once per event: the trigger is noisy — debounce it at the
    source (e.g. the Digital Input filter).
  • Count wraps unexpectedly: turn Rollover off to clamp at Min / Max.
  • Wrong value at power-up: set Start value; after a reset it uses Reset
    value
    instead.

Related

Updated by Adam Klama 1 day ago · 2 revisions