CTU — Count Up
CTU
Counter
counter
(CU)
Preset
?
(DN)
Accum
?
Increments .ACC by 1 on each rising edge of the rung. Sets .DN when .ACC reaches .PRE; keeps counting past the preset.
Operands
| Name | Type |
|---|---|
counter | COUNTER |
How It Works
| Event | .ACC | .CU | .DN |
|---|---|---|---|
| Rising edge of rung | +1 | 1 | 1 when .ACC ≥ .PRE |
| Rung stays true | unchanged | 1 | unchanged |
| Rung false | unchanged | 0 | unchanged |
RES on the tag | 0 | 0 | 0 |
CTU counts on the transition from false to true. Holding the input true does not keep counting.
A rung that is already true when the program starts does not count either. The counter only counts a change it sees while the program is running — the rung has to go false, then true. (Prescan sets this up before the first scan.)
Example — Parts Counter
Count boxes passing a sensor. Signal "full" at 10 boxes.
Tag setup: Boxes is a COUNTER with .PRE = 10.
XIC(BoxSensor)CTU(Boxes);XIC(Boxes.DN)OTE(BinFull);XIC(ResetBtn)RES(Boxes)
Practice
Try CTU in the Count Up exercise — count input pulses and act when the target is reached.
Common Mistakes
- Adding
ONSbefore aCTU— unnecessary.CTUalready counts on the rising edge. - Expecting
.DNto block further counting — it does not..ACCkeeps climbing. Add aRESor an interlock if you need to stop.
Related
- Counters overview — members, units, shared behaviour
- CTD — count-down counterpart
- RES — clears the accumulator