CTU — Count Up

CTU (Count Up) in rungs.dev increments .ACC by 1 on each rising edge of the rung. Sets .DN when .ACC reaches .PRE and keeps counting past the preset value.

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

NameType
counterCOUNTER

How It Works

Event.ACC.CU.DN
Rising edge of rung+111 when .ACC.PRE
Rung stays trueunchanged1unchanged
Rung falseunchanged0unchanged
RES on the tag000

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.

0

BoxSensor

CTU

Counter

Boxes

(CU)

Preset

10

(DN)

Accum

0

1

Boxes.DN

BinFull

2

ResetBtn

Boxes

RES

Practice

Try CTU in the Count Up exercise — count input pulses and act when the target is reached.

Common Mistakes

  • Adding ONS before a CTU — unnecessary. CTU already counts on the rising edge.
  • Expecting .DN to block further counting — it does not. .ACC keeps climbing. Add a RES or an interlock if you need to stop.
  • Counters overview — members, units, shared behaviour
  • CTD — count-down counterpart
  • RES — clears the accumulator

On this page