Skip to main content

CTD — Count Down

CTD

Counter

counter

(CD)

Preset

?

(DN)

Accum

?

Decrements .ACC by 1 on each rising edge of the rung. Typically paired with CTU on the same COUNTER tag.

Operands

NameType
counterCOUNTER

How It Works

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

.ACC can go negative. .DN tracks the preset comparison regardless of direction.

Example — Remaining Slots

A parking lot has 20 slots. A CTU counts cars entering; a CTD counts cars leaving. Both write to the same tag.

Tag setup: CarsInLot is a COUNTER with .PRE = 20.

XIC(EntrySensor)CTU(CarsInLot);XIC(ExitSensor)CTD(CarsInLot);XIC(CarsInLot.DN)OTE(LotFull)

Common Mistakes

  • Expecting CTD to stop at zero — it does not. Use a comparison (GE / LE) if you need a floor.
  • Pairing CTU and CTD on different tags — both instructions must target the same COUNTER tag for the counts to net out.