Uploaded November 2026 | Updated November 2026, 21 hours ago
PLC counters CTU, CTD and CTUD on a conveyor buffer: counters count edges not time, and a count up count down pair has an ambiguous done bit.
⥠QUICK ANSWER
A counter does not care how long its rung is true. It adds one on the rising edge, so a box can sit in front of a sensor for ten seconds and still count once, and the rung has to go false and true again before it counts another. Beyond that, the three types differ in ways that matter. A count up counter adds one per edge and does not stop at its preset, so the next edge takes it one above. A count down counter subtracts, never goes below zero, and sets its done bit at zero, which is why in ladder it has to be paired with a count up counter on the same address. That pair is the problem the video is really about, because its single done bit means full after counting up and empty after counting down. An up down counter does both jobs in one instruction and its done bit always means one thing: the count is at or above the preset. All of them are retentive, so a stop and a run leaves the count exactly where it was.
đ FULL STEP-BY-STEP + DOWNLOADS (example program, Structured Text file)
accautomation.ca/plc-counters-ctu-ctd-ctud
ACC PLC Simulator: accautomation.ca/simulator
Example ladder logic file: accautomation.ca/simulator/acc-example-conveyor-counters.json
Structured Text file: accautomation.ca/simulator/acc-example-conveyor-counters.st
âąī¸ TIMESTAMPS
00:00 CTU vs CTD vs CTUD: Which PLC Counter Do You Need?
00:47 Where You Find Counters
01:10 A Counter Counts Edges
01:32 Count Up (CTU)
01:55 Reading the Counter Block
02:18 Count Down (CTD)
02:40 Count Up and Down (CTUD)
03:02 Counters Remember
03:27 Step One, Define the Task (PLC Program Development)
03:51 Step Two, Define the I/O
04:22 Step Three, the Sequence
04:47 Step Four, the Program
05:10 Hold at the Load Station
05:31 Two Counters, One Address
05:54 The Structured Text Version
06:17 Step Five, Testing the Count
06:45 Testing Buffer Full
07:20 Testing an Empty Buffer
07:44 Testing Stop and Reset
08:08 Testing with a Real PLC
08:31 Common Counter Mistakes
08:55 Three Counters, One Conveyor
09:16 Try It Yourself
đ WHAT YOU'LL LEARN
â Count one part per arrival regardless of how slowly it passes the sensor, because a counter responds to the rising edge rather than to the rung staying true
â Build a buffer count two ways, as a count up and count down pair sharing one address and as a single up down counter, then compare what their done bits actually tell you
â Compare the accumulated count instead of trusting a pair's done bit, which flips meaning depending on which direction you last counted
â Gate the hold on position as well as the count, so a full buffer stops the conveyor at the load station rather than leaving a part halfway down the belt
â Clear a retentive count with a reset instruction, and recognise that a stop and a run will not do it
â FREQUENTLY ASKED
Q: Does a count up counter stop when it reaches its preset?
A: No. The done bit turns on at the preset but the counter keeps going, so the next edge leaves the accumulated value one above the preset. If you need it to stop there, the logic has to do that itself.
Q: Why would anyone use a count up and count down pair instead of an up down counter?
A: Because the pair is how an up down count was built before the up down instruction existed, and plenty of working programs still use it. The catch is the shared done bit, which reads as full after counting up and as empty after counting down.
Q: Do counters lose their value when the PLC stops?
A: No, counters are retentive. Stop and run the controller and the count is still there, which is correct behaviour because the parts on a real machine did not disappear. Only a reset instruction on the counter's address clears it.
Q: Will this work on a real PLC over Modbus?
A: It will, but watch the poll rate. The box passes each sensor in roughly a tenth of a second, so a slow poll can miss the edge entirely and lose counts.
đ Full step-by-step, example program and Structured Text file: accautomation.ca/plc-counters-ctu-ctd-ctud
đ MORE RESOURCES
âļ Free ACC PLC Simulator, runs in your browser: accautomation.ca/simulator
âļ PLC timers explained, TON, TOF and RTO: accautomation.ca/plc-timers-explained-ton-tof-rto
âļ PLC Beginners Guide: accautomation.ca/programming/plc-beginners-guide
âļ Free eBooks: accautomation.ca (subscribe for download)
đ RECOMMENDED HARDWARE
âļ Shop: automationdirect.com
âļ Parts Guide: accautomation.ca/purchase-find-parts
đŦ Questions? Drop a comment below.
đ New tutorials every Monday â Subscribe and hit the bell!
#PLC #LadderLogic #IndustrialAutomation #PLCProgramming #ACCAutomation #PLCCounter #StructuredText #PLCTutorial #LearnPLC
Regards,
Garry
ACC Automation
accautomation.ca
PLC counters CTU, CTD and CTUD on a conveyor buffer: counters count edges not time, and a count up count down pair has an ambiguous done bit.
⥠QUICK ANSWER
A counter does not care how long its rung is true. It adds one on the rising edge, so a box can sit in front of a sensor for ten seconds and still count once, and the rung has to go false and true again before it counts another. Beyond that, the three types differ in ways that matter. A count up counter adds one per edge and does not stop at its preset, so the next edge takes it one above. A count down counter subtracts, never goes below zero, and sets its done bit at zero, which is why in ladder it has to be paired with a count up counter on the same address. That pair is the problem the video is really about, because its single done bit means full after counting up and empty after counting down. An up down counter does both jobs in one instruction and its done bit always means one thing: the count is at or above the preset. All of them are retentive, so a stop and a run leaves the count exactly where it was.
đ FULL STEP-BY-STEP + DOWNLOADS (example program, Structured Text file)
accautomation.ca/plc-counters-ctu-ctd-ctud
ACC PLC Simulator: accautomation.ca/simulator
Example ladder logic file: accautomation.ca/simulator/acc-example-conveyor-counters.json
Structured Text file: accautomation.ca/simulator/acc-example-conveyor-counters.st
âąī¸ TIMESTAMPS
00:00 CTU vs CTD vs CTUD: Which PLC Counter Do You Need?
00:47 Where You Find Counters
01:10 A Counter Counts Edges
01:32 Count Up (CTU)
01:55 Reading the Counter Block
02:18 Count Down (CTD)
02:40 Count Up and Down (CTUD)
03:02 Counters Remember
03:27 Step One, Define the Task (PLC Program Development)
03:51 Step Two, Define the I/O
04:22 Step Three, the Sequence
04:47 Step Four, the Program
05:10 Hold at the Load Station
05:31 Two Counters, One Address
05:54 The Structured Text Version
06:17 Step Five, Testing the Count
06:45 Testing Buffer Full
07:20 Testing an Empty Buffer
07:44 Testing Stop and Reset
08:08 Testing with a Real PLC
08:31 Common Counter Mistakes
08:55 Three Counters, One Conveyor
09:16 Try It Yourself
đ WHAT YOU'LL LEARN
â Count one part per arrival regardless of how slowly it passes the sensor, because a counter responds to the rising edge rather than to the rung staying true
â Build a buffer count two ways, as a count up and count down pair sharing one address and as a single up down counter, then compare what their done bits actually tell you
â Compare the accumulated count instead of trusting a pair's done bit, which flips meaning depending on which direction you last counted
â Gate the hold on position as well as the count, so a full buffer stops the conveyor at the load station rather than leaving a part halfway down the belt
â Clear a retentive count with a reset instruction, and recognise that a stop and a run will not do it
â FREQUENTLY ASKED
Q: Does a count up counter stop when it reaches its preset?
A: No. The done bit turns on at the preset but the counter keeps going, so the next edge leaves the accumulated value one above the preset. If you need it to stop there, the logic has to do that itself.
Q: Why would anyone use a count up and count down pair instead of an up down counter?
A: Because the pair is how an up down count was built before the up down instruction existed, and plenty of working programs still use it. The catch is the shared done bit, which reads as full after counting up and as empty after counting down.
Q: Do counters lose their value when the PLC stops?
A: No, counters are retentive. Stop and run the controller and the count is still there, which is correct behaviour because the parts on a real machine did not disappear. Only a reset instruction on the counter's address clears it.
Q: Will this work on a real PLC over Modbus?
A: It will, but watch the poll rate. The box passes each sensor in roughly a tenth of a second, so a slow poll can miss the edge entirely and lose counts.
đ Full step-by-step, example program and Structured Text file: accautomation.ca/plc-counters-ctu-ctd-ctud
đ MORE RESOURCES
âļ Free ACC PLC Simulator, runs in your browser: accautomation.ca/simulator
âļ PLC timers explained, TON, TOF and RTO: accautomation.ca/plc-timers-explained-ton-tof-rto
âļ PLC Beginners Guide: accautomation.ca/programming/plc-beginners-guide
âļ Free eBooks: accautomation.ca (subscribe for download)
đ RECOMMENDED HARDWARE
âļ Shop: automationdirect.com
âļ Parts Guide: accautomation.ca/purchase-find-parts
đŦ Questions? Drop a comment below.
đ New tutorials every Monday â Subscribe and hit the bell!
#PLC #LadderLogic #IndustrialAutomation #PLCProgramming #ACCAutomation #PLCCounter #StructuredText #PLCTutorial #LearnPLC
Regards,
Garry
ACC Automation
accautomation.ca










