Guide · 4 min read · Free to try

PLC counters explained: count up, count down and reset

A counter adds up events: boxes past a sensor, presses of a button, cars through a gate. It counts the moment a signal turns on, not how long it stays on. Here is how count up, count down and reset work, scan by scan.

Free in FORGE, the online PLC simulator. No install, and no account to start.

The counter instructions

InstructionWhat it doesDone bit (DN)
Count up (CTU)Adds 1 to ACC each time its rung turns from false to trueOn while ACC is at or above PRE
Count down (CTD)Takes 1 off ACC each time its rung turns from false to trueOn while ACC is at or above PRE
Reset (RES)Sets ACC back to 0 and clears the status bitsOff after the reset

A counter keeps its count when its rung goes false. Unlike an on-delay timer, nothing clears it until a reset runs.

Count up (CTU): count events

A count-up counter adds 1 on each scan where its rung turns on. A held signal counts once, so a box that sits in front of the sensor is not counted again.

CTU with PRE 3. ACC adds 1 on each scan where Run turns on, not while Run stays on. DN turns on when ACC reaches 3 and stays on as ACC keeps counting.Scan12345678910Run.CU.DN.ACC01122334442 Count 14 Count 26 Count 3: DN

Recorded from a real run in FORGE: PRE 3. DN turns on at the third count and stays on as ACC keeps counting.

TagValue
PartEye1
PartsPRE 2 ACC 2 CU 1 CD 0 DN 1 OV 0 UN 0
BoxFull1

Two parts passed. Parts.DN turned BoxFull on.

Count down (CTD): count what is left

A count-down counter takes 1 off on each rising edge. Start ACC at the stock you have and PRE at the level to act on. DN stays on while ACC is at or above PRE and turns off when the count drops below it.

CTD with PRE 0 and ACC starting at 3. ACC takes 1 off on each scan where Run turns on, not while Run stays on. DN is on while ACC is at or above PRE and turns off when ACC goes below it.Scan12345678910Run.CD.DN.ACC3221100-1-1-12 Count 24 Count 16 Count 0

Recorded from a real run in FORGE: ACC starts at 3 and PRE is 0.

TagValue
PickEye1
StockPRE 2 ACC 1 CU 0 CD 1 DN 0 OV 0 UN 0
Reorder1

Two picks took Stock from 3 to 1. ACC is below PRE, so Reorder is on.

Up and down on one count: a car park

Put a CTU and a CTD on the same COUNTER tag. The entry sensor counts up, the exit sensor counts down, and ACC is the number of cars inside. Light Full when ACC reaches the number of spaces. The up-down counting technique shows the rungs.

Reset

RES on the counter tag sets ACC to 0. Put it on its own rung behind a reset button or the end of a batch, so a new count starts clean.

Mistakes to avoid

No reset

A counter never clears itself. Without a RES the count keeps climbing from one batch into the next.

Expecting a held signal to keep counting

A counter counts false-to-true changes. A rung held true counts once.

Waiting for DN when a count-down runs out

DN is on while ACC is at or above PRE. It turns off when the count drops below PRE, so act on DN turning off.

Practise counters for free

Each exercise opens in FORGE and checks your rungs in simulation.

  • Count the boxesCount boxes passing a sensor and turn on a lamp when five have passed.Easy · 7 minFree
  • Count to tenCount parts in batches of ten. Each full batch adds one to a batch count, and the part count starts again from zero.Medium · 12 minFree
  • Cars in, cars outTrack the cars in a 20-space car park with an entry sensor and an exit sensor, and light Full when every space is taken.Hard · 15 minFree
  • Bottling line jamThe line stops now and then. The fault is an interaction between the infeed counter and the capper interlock.Challenging · 30 minPro

Learn it in a course

The course has a video, short steps, a quiz and a hands-on practical checked in FORGE.

Counting events

Count events up and down, then act when the count reaches its preset. A reset clears the count.

Intermediate · 25 min · Pro

Courses are in the Pro and Student plans, with a 7-day free trial. See plans

Questions

What is the difference between CTU and CTD?

CTU adds 1 to the accumulated value on each rising edge of its rung. CTD takes 1 off. Both use the same COUNTER tag, so they can share one count.

Does a PLC counter count while the input stays on?

No. It counts the moment the rung turns from false to true. The rung has to go false and true again for the next count.

How do you reset a PLC counter?

Run a RES instruction on the counter tag. It sets the accumulated value to 0 and clears the status bits. The preset stays.

Can I practise PLC counters without a PLC?

Yes. FORGE runs ladder logic scan by scan in your browser, and three of the counter exercises are free.

Count your first boxes now.

Open Count the boxes and light a lamp when five have passed the sensor.