This is an old revision of the document!
Table of Contents
MPINO STUDIO 2 Phase 4-2 · Counter Box Functions
These commands count signal transitions and provide a current value and completion state.
This ladder screen shows CTU connected to a counter input condition.
1. Common Rules
Use C for a 16-bit counter and DC for a 32-bit counter. The count changes once on each OFF-to-ON transition. A bit contact for the counter address reads its done state, and a ladder RESET coil initializes the current value. C0 through C10 are mapped to board functions on MPINO-8A4R(T)-S, so the examples on this page use C11 and C12.
2. CTU
Count Up Counter
Increments the current value once whenever the left condition changes from OFF to ON. The done state turns ON at or above the set value, and counting stops at the maximum value.
Syntax: CTU C11 3
| Run condition | Before | Command entered | Expected result |
|---|---|---|---|
| Left condition ON | C11=0 | CTU C11 3 | 3 rising edges → C11=3, C11 done contact=ON |
3. CTD
Count Down Counter
Preloads the current value with the set value, then decrements it once on each rising edge of the left condition. The done state turns ON at zero, where counting stops.
Syntax: CTD C12 3
| Run condition | Before | Command entered | Expected result |
|---|---|---|---|
| Left condition ON | C12=3 | CTD C12 3 | 3 rising edges → C12=0, C12 done contact=ON |
4. CTUD
Count Up/Down Counter
While the left condition is ON, a rising edge on the up input adds one and a rising edge on the down input subtracts one. If both rise in the same scan, the value does not change.
Syntax: CTUD C11 M0 M1 3
| Run condition | Before | Command entered | Expected result |
|---|---|---|---|
| Left condition ON | C11=0 | CTUD C11 M0 M1 3 | M0 ×2, M1 ×1 → C11=1 |
5. Troubleshooting
| Symptom | What to check |
|---|---|
| I expected the value to keep increasing while holding the button. | A counter changes its value only once on each rising edge. |
| CTD does not decrease below zero. | CTD stops at its lower limit of zero. |

