Use on-delay timers (TON) and up-counters (CTU) in PLC logic, and simulate a counting station with a timed delay.
Why it matters
Almost every machine needs to wait or count: run a horn for 3 seconds before a conveyor starts, hold a clamp for 2 seconds, count 12 parts into a box, stop after 500 cycles for a tool change. Timers and counters are the PLC instructions that do this, and their accumulated values are among the first things you check when a sequence stalls.
Timer basics
A PLC timer has:
- a preset (PRE): the target time, for example 3,000 ms;
- an accumulator (ACC): the time counted so far;
- status bits: EN (enabled, the rung is true), TT (timer timing) and DN (done).
Timers count in the background, scan by scan: each scan the PLC adds the time since the last scan to ACC. That is why timer accuracy is limited by the scan time.
TON: on-delay
While the rung is true, ACC counts up. When ACC reaches PRE, DN turns on. If the rung goes false at any time, ACC resets to 0 and DN turns off.
Rung true: ____|‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾|____
TON DN: __________________|‾‾‾‾‾‾‾|____
<--- PRE --->
Uses: a start-up warning horn, debouncing a sensor that flickers, an alarm only if low pressure lasts more than 5 seconds.
TOF: off-delay
DN turns on as soon as the rung is true and stays on for PRE after the rung goes false. Uses: keep a cooling fan running for 2 minutes after a motor stops.
RTO: retentive timer
Like TON, but ACC holds its value when the rung goes false. It needs a separate reset (RES) instruction. Uses: total run hours on a pump before a PM is due.
Counter basics
A counter has a preset, an accumulator and a done bit too, but it counts events, not time.
- CTU (count up): adds 1 each time its rung goes from false to true (a rising edge). Holding the input on does not keep counting.
- CTD (count down): subtracts 1 on each rising edge.
- RES: resets the accumulator to 0.
DN turns on when ACC is at or above PRE. Counters usually keep counting past the preset, so the logic must decide what happens next.
Worked example 1: warning horn
When START is pressed, a horn sounds for 3 seconds, then the conveyor runs.
1 START_REQ seal-in (from START, STOP) -> START_REQ
2 START_REQ ---------------------------------------- TON T1 PRE 3000
3 START_REQ AND NOT T1.DN -------------------------- -> HORN
4 START_REQ AND T1.DN ------------------------------ -> CONVEYOR
Pressing STOP drops START_REQ, which resets T1 and stops everything.
Worked example 2: counting into a case
A photo-eye produces one pulse per bottle. After 6 bottles the conveyor stops so the operator can swap the case; 2 seconds later the counter resets and the conveyor restarts.
1 PHOTO_EYE ---------------------------------------- CTU C1 PRE 6
T2.DN ---------------------------------------------- RES C1
2 C1.DN ---------------------------------------------- TON T2 PRE 2000
3 NOT C1.DN ------------------------------------------ -> CONVEYOR
Trace it: each bottle adds 1 to C1.ACC. On the 6th, C1.DN turns on, rung 3 stops the conveyor and rung 2 starts T2. When T2.DN turns on, C1 resets; C1.DN goes off, which disables T2 (resetting it) and restarts the conveyor. This is the station you will simulate in the Do tab.
Timing and the scan
In the simulation, each scan adds a fixed time step, which is how a real PLC behaves: if the scan is 10 ms, ACC goes up in roughly 10 ms steps. A 2,000 ms timer in a 10 ms scan finishes on the 200th scan after it is enabled. If a scan happened to take 25 ms near the end, ACC would still stop at the preset rather than overshoot, because the timer clamps ACC at PRE.
Troubleshooting with timers and counters
When a sequence stops, go online and look at the timer and counter values:
- A TON with ACC stuck at 0 means its rung is false: find the missing condition.
- A TON that keeps resetting near the end means a flickering input: consider a debounce timer.
- A counter that counts double may be seeing a bouncing sensor, or two rungs may be counting the same event.
- A counter that never reaches preset may be missing fast pulses (see the scan cycle lesson).
Common mistakes
- Expecting a TON to remember its time when the rung goes false (that is an RTO).
- Forgetting to reset a counter or retentive timer.
- Using a TON where a TOF is needed, or the reverse.
- Units: some platforms use milliseconds, others a time base of 0.01 s or 1 s. Check before typing 3000.
Safety
Timers must never be the only protection on a safety function such as a guard door: those use safety-rated devices, covered later in this course. Control panels contain voltages that can kill, stored energy in drives and capacitors, and machines that can start unexpectedly. Everything in this course is practised on paper or in simulators. Working in real panels requires employer training, supervision by a qualified person, lockout/tagout and the arc-flash practices in NFPA 70E (https://www.nfpa.org/codes-and-standards/nfpa-70e-standard-development/70e), and for electricians a registered apprenticeship and state or local licence. Checked on 2026-10-23.
Recap
- TON: DN on after PRE of continuous true; resets when false. TOF: delay after false. RTO: keeps ACC until RES.
- CTU counts rising edges; DN at ACC ≥ PRE; RES clears it.
- ACC goes up in scan-time steps and clamps at PRE.
Try it
Open the Do tab and finish the TON instruction that drives the case-packing station.