Counters (output instruction)

CTD: Count Down

Subtracts one from its accumulator on every false-to-true transition of the rung.

Also called: down counter, remaining count.

CTD(counter, preset)

Arguments

NameWhat it isAcceptsDefault
destinationWhat the instruction acts ona counterrequired
presetPreseta whole number4

Arguments are positional and this table is generated from the simulator's own instruction registry, so it always matches what the engine accepts.

What it does

CTD counts the other way, and it is the natural instruction whenever the number an operator cares about is how many are left rather than how many have been done: parts remaining in a magazine, labels left on a reel, doses left in a batch.

It is usually paired with a MOV that loads the starting quantity, because a down counter has to be told where to start.

A rung you can run

Parts remaining in a feeder, with a low-stock warning

[object Object]
XIC(Feeder_Reload)ONS(Reload_Edge)MOV(Parts_Left,200)
XIC(Part_Taken)ONS(Taken_Edge)CTD(Feed_Count,0)
LES(Parts_Left,20)OTE(Low_Stock_Lamp)

Reloading the feeder sets the remaining count back to 200, and the lamp warns the operator before it runs dry.

Run this rung in the simulator

What it is called on other controllers

PlatformEquivalent
Rockwell (Studio 5000)CTD
Siemens (TIA Portal)CTD
CODESYS and IEC 61131-3CTD

Common mistakes

  • Not preloading the accumulator, so the counter starts at zero and goes negative.
  • Using CTD when the operator actually wants to see progress towards a target, where a CTU reads more naturally on the HMI.

Practise it

Interactive exercises that use CTD. Each one checks your ladder against a real scan.

Related instructions

All ladder logic instructions