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
| Instruction | What it does | Done bit (DN) |
|---|---|---|
| Count up (CTU) | Adds 1 to ACC each time its rung turns from false to true | On while ACC is at or above PRE |
| Count down (CTD) | Takes 1 off ACC each time its rung turns from false to true | On while ACC is at or above PRE |
| Reset (RES) | Sets ACC back to 0 and clears the status bits | Off 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.
Recorded from a real run in FORGE: PRE 3. DN turns on at the third count and stays on as ACC keeps counting.
| Tag | Value |
|---|---|
| PartEye | 1 |
| Parts | PRE 2 ACC 2 CU 1 CD 0 DN 1 OV 0 UN 0 |
| BoxFull | 1 |
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.
Recorded from a real run in FORGE: ACC starts at 3 and PRE is 0.
| Tag | Value |
|---|---|
| PickEye | 1 |
| Stock | PRE 2 ACC 1 CU 0 CD 1 DN 0 OV 0 UN 0 |
| Reorder | 1 |
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.Free
- 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.Free
- 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.Free
- Bottling line jamThe line stops now and then. The fault is an interaction between the infeed counter and the capper interlock.Pro
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.
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.