en-us_products:mpino_studio2:box_functions:counter:ctud
Table of Contents
CTUD Box Function
Count Up/Down Counter
Category: Counter Box Functions
Behavior
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 and Arguments
Syntax: CTUD C11 M0 M1 3
- Target — counter memory C<n> (16-bit) or DC<n> (32-bit)
- up — the bit contact to increment (e.g. P0/M1)
- down — the bit contact to decrement (e.g. P1/M2)
- preset — count at which the done bit turns ON. An integer or a memory address such as
D10(time units are not accepted)
Behavior Example
| Run condition | Before | Command entered | Expected result |
|---|---|---|---|
| Left condition ON | C11=0 | CTUD C11 M0 M1 3 | M0 ×2, M1 ×1 → C11=1 |
Cautions
- A counter changes once per rising edge of the left condition. On MPINO-8A4R(T)-S, C0 through C10 are mapped to board functions, so use C11 or later for a counter.
- If you enter a memory address such as
D10as the preset, you can change the target count while running, for example from an HMI. When the memory value is 0, the counter does not complete. For details, see Set the Preset from Memory.
Box Functions in the Same Category
- CTU View details — Count Up Counter
- CTD View details — Count Down Counter
en-us_products/mpino_studio2/box_functions/counter/ctud.txt · Last modified: by 127.0.0.1
