Project

General

Profile

Counter Input » History » Version 1

Adam Klama, 06/21/2026 02:16 PM

1 1 Adam Klama
# Counter Input
2
3
## Overview
4
A **Counter Input** keeps a running count that goes **up** and **down** as trigger
5
inputs fire. Three inputs drive it: one increments, one decrements, and one
6
resets it. Use it to tally events — shift counts, button presses, fault
7
occurrences — or to maintain a step value you nudge up and down.
8
9
## Prerequisites & hardware
10
You need up to three **trigger inputs**, each referenced by alias:
11
- An **up** input that increments the count.
12
- A **down** input that decrements it.
13
- A **reset** input that reloads the reset value.
14
15
Triggers are typically boolean signals such as a [Compare Input](Compare-Input.md)
16
or a [Digital Input](Digital-Input.md); the counter steps on each trigger edge.
17
Any trigger you do not need can be left unset.
18
19
## Add it in the app
20
1. Add a new input and choose **Counter Input** as the type.
21
2. Choose the **up / down / reset** trigger inputs.
22
3. Give it a clear **alias** (e.g. `Shift Count`).
23
4. Set the **step**, the **min / max** limits, the **start** and **reset**
24
   values, and whether the count **rolls over**.
25
26
## Settings reference
27
> Schema: `config/CounterInputConfiguration.proto`.
28
29
| Setting | Meaning | Unit | Range / values | Notes |
30
|---|---|---|---|---|
31
| **Up input** | Trigger that increments the count | — | an existing input (by alias) | Counts up by **Step** on each edge. |
32
| **Down input** | Trigger that decrements the count | — | an existing input (by alias) | Counts down by **Step** on each edge. |
33
| **Reset input** | Trigger that reloads **Reset value** | — | an existing input (by alias) | When it fires, the count jumps to **Reset value**. |
34
| **Step** | Amount added/subtracted per trigger | count | int32 | The increment size. Usually `1`. |
35
| **Min value** | Lowest the count may reach | count | int32 | Clamp limit (see **Rollover**). |
36
| **Max value** | Highest the count may reach | count | int32 | Clamp limit (see **Rollover**). |
37
| **Start value** | Count at power-up | count | int32 | The value loaded when the controller starts. |
38
| **Reset value** | Value loaded on reset | count | int32 | What the count becomes when the reset input fires. |
39
| **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. |
40
41
**Edge triggering:** the count changes once per trigger event, not continuously
42
while a trigger is held. At the limits, **Rollover** decides between wrapping and
43
clamping.
44
45
## Common settings
46
Counter Input also uses the shared setting — alias. See [Common IO Settings](../Common-IO-Settings.md).
47
48
## Example — count gear shifts
49
1. Type **Counter Input**, alias `Shift Count`.
50
2. **Up input** = a [Compare Input](Compare-Input.md) that fires on each shift.
51
3. **Reset input** = a `Trip Reset` button input.
52
4. **Step** `1`, **Start value** `0`, **Reset value** `0`.
53
5. **Min** `0`, **Max** `999999`, **Rollover off** so it simply tallies up until
54
   reset.
55
56
## Troubleshooting
57
- **Count never changes:** check the trigger inputs actually toggle and that **Up
58
  / Down** are assigned.
59
- **Counts more than once per event:** the trigger is noisy — debounce it at the
60
  source (e.g. the [Digital Input](Digital-Input.md) filter).
61
- **Count wraps unexpectedly:** turn **Rollover off** to clamp at **Min / Max**.
62
- **Wrong value at power-up:** set **Start value**; after a reset it uses **Reset
63
  value** instead.
64
65
## Related
66
- [Compare Input](Compare-Input.md) — generate the trigger events to count.
67
- [Digital Input](Digital-Input.md) — count switch/button edges.
68
- [Frequency Input](Frequency-Input.md) — measure pulse frequency/speed instead.