The Up/Down Counter increases or decreases its internal counter according to rising edges received on the Increment and Decrement input connectors.
A rising edge on Increment increases the counter by one, while a rising edge on Decrement decreases it by one.
If the Reboot survive property is enabled, the current counter value is stored on the server and is preserved after a reboot. After the restart, subsequent increments or decrements continue from the last saved value.
If Reboot survive is disabled, the counter value is reset when the server reboots.
The Start Date output connector provides the date and time of the most recent reset operation.
When the Reset input receives 1, the counter is reset, Output goes to 0 and Start Date is updated. Counting can resume only after Reset returns to 0.
Behaviour of Up/Down Counter
| Connector | Type | Description |
|---|---|---|
| Increment | Input | Increases the counter by one when a rising edge is received. |
| Decrement | Input | Decreases the counter by one when a rising edge is received. |
| Reset | Input | Resets the counter when set to 1. |
| Output | Output | Current counter value. |
| Start Date | Output | Date and time of the most recent reset operation. |
| Property | Description |
|---|---|
| Reboot survive | Defines whether the counter value is preserved after a server reboot. When enabled, the value is stored on the server and restored after restart. |
The Up/Down Counter reacts to rising edges on the Increment and Decrement inputs.
A rising edge is the transition:
0 → 1
When a rising edge is detected on Increment:
Output = Output + 1
When a rising edge is detected on Decrement:
Output = Output - 1
The value is not continuously modified while an input remains at 1.
A new change occurs only when a new rising edge is received.
To generate another increment or decrement, the corresponding input must return to 0 and then change to 1 again.
Consider an initial counter value of:
Output = 0
The following sequence is applied:
| Event | Resulting Output |
|---|---|
| Rising edge on Increment | 1 |
| Rising edge on Increment | 2 |
| Rising edge on Increment | 3 |
| Rising edge on Decrement | 2 |
| Rising edge on Increment | 3 |
| Rising edge on Decrement | 2 |
The counter therefore follows the sequence of increment and decrement commands received by the node.
The Increment input increases the current counter value by one whenever a rising edge is received.
For example:
| Increment | Output |
|---|---|
| 0 | 5 |
| 1 | 6 |
| 1 | 6 |
| 0 | 6 |
| 1 | 7 |
Keeping Increment at 1 does not continuously increase the counter.
A new increment occurs only after the signal returns to 0 and another rising edge is generated.
The Decrement input decreases the current counter value by one whenever a rising edge is received.
For example:
| Decrement | Output |
|---|---|
| 0 | 5 |
| 1 | 4 |
| 1 | 4 |
| 0 | 4 |
| 1 | 3 |
As with the Increment input, the signal must return to 0 before another rising edge can be detected.
The Reset input clears the current counter value.
When:
Reset = 1
the node performs the following operations:
Normal counting resumes only after:
Reset = 0
The Reset signal must return to 0 after the reset operation.
While Reset remains equal to 1, the counter does not resume normal operation.
The Start Date output indicates when the current counting period started.
Each time the Reset input is activated, Start Date is updated with the date and time of that reset.
For example:
| Event | Start Date |
|---|---|
| Initial reset | 01/09/2026 09:00 |
| Increment / Decrement operations | 01/09/2026 09:00 |
| New reset | Updated to the new reset date and time |
The value therefore identifies the beginning of the current counting cycle.
The Reboot survive property defines whether the current counter value is preserved when the Thinknx server restarts.
When Reboot survive is enabled:
When Reboot survive is disabled:
Enable Reboot survive when the counter represents information that must be preserved across server restarts.
The Up/Down Counter is useful whenever events must be counted in both directions.
Typical applications include:
An entrance sensor is connected to Increment, while an exit sensor is connected to Decrement.
Each detected entry generates a rising edge on Increment:
Output = Output + 1
Each detected exit generates a rising edge on Decrement:
Output = Output - 1
The Output therefore represents the current number of people inside the monitored area.
If the counter must be cleared at the beginning of a new period, the Reset input can be activated.
The Up/Down Counter can be tested using the Logic Module simulation tools.
A typical test procedure is the following: