07
Programming Timers
Almost every machine you’ll ever program needs to wait. Wait five seconds before starting so the operator can step back. Wait two minutes after the motor stops so the cooling fan can run on. Wait one hundred operating hours and then pop a maintenance alarm. This chapter teaches the three timer instructions that handle all three jobs — TON, TOF, and RTO — plus how to cascade them for sequences and reciprocate them for flashing lights and pulse trains.
What you’ll be able to do after this chapter
Your goals for this chapter:
- Explain how a mechanical timing relay works and why software timers replaced them.
- Identify the four control bits every timer instruction provides —
EN,TT,DN, and the accumulatorACC. - Choose the right timer for the job: TON for delayed starts, TOF for run-on, RTO for retentive accumulation.
- Set preset (PRE) and time base correctly so a 5-second delay actually takes 5 seconds.
- Build a cascading timer chain where the DN bit of one timer enables the next — the basis of every traffic-light, oven-bake, and wash-cycle program.
- Build a reciprocating (oscillator) circuit using two timers feeding each other for free-running flash and pulse trains.
- Use timer control bits inside other rungs to drive outputs, alarms, and intermediate logic.
Key Concepts & Terms
Mechanical Timing Relays — The Ancestors
Long before PLCs, when an engineer needed a “five-second delay before the motor starts”, they reached for a mechanical timing relay. Two types dominated:
Pneumatic Dashpot Timer
Air-bleed timing. When the relay’s coil energises, a piston starts moving against a spring, but a tiny needle valve restricts the airflow into or out of a chamber. The piston creeps slowly until, at the end of its travel, it trips a contact. Adjust the needle valve and you adjust the delay (typically 0.05 s to 60 s). Cheap, mechanical, no electronics — but accuracy drifts with temperature and humidity, and the seals harden over time.
Synchronous Motor Timer
A small AC synchronous motor (locked to the mains frequency, 50 or 60 Hz) drives a cam through a reduction gearbox. After a settable number of revolutions the cam closes a contact. Far more accurate than a dashpot — within ±1 % — and stable over decades. The cylindrical “cam-stack” timers you’ll still find on industrial laundry machines, dishwashers, and old conveyor controls work this way.
Why we replaced them with software
Mechanical timers do exactly one thing — count one delay — and the moment the customer asks for “ten seconds, but only when conveyor 2 is running”, you need extra contacts and another timing relay. With a PLC, every timer is just a few lines of memory. Adding a tenth or a hundredth timer costs nothing. Modern programs use software timers exclusively.
PLC Timer Instructions — The Anatomy
Every PLC timer is a small block of memory — typically called a timer file (T4 in Allen-Bradley SLC/PLC-5 syntax) — with a fixed structure. The most important fields are:
| Field | What it holds | You set it / It sets itself |
|---|---|---|
PRE — Preset | The target time, in time-base units. PRE = 50 with a 0.1 s base means 5 seconds. | You set it (when programming) |
ACC — Accumulator | How much time has elapsed so far, also in time-base units. | The PLC sets it (counts up) |
| Time base | 0.001 s, 0.01 s, 0.1 s, or 1.0 s — the granularity of the count. | You set it |
EN — Enable | Bit that mirrors the rung condition. 1 if the rung is true, 0 if not. | The PLC sets it |
TT — Timer Timing | 1 while the timer is actively counting (rung true, ACC < PRE). 0 the instant timing finishes or the rung drops. | The PLC sets it |
DN — Done | 1 when ACC has reached PRE. This is the bit you usually wire into other rungs to drive outputs. | The PLC sets it |
Three timer instructions exist on every modern PLC, and they differ only in how the accumulator behaves when the rung goes false:
- TON (Timer On-Delay) — accumulator counts up while the rung is true. Resets to 0 the instant the rung goes false. “How long has the input been on?”
- TOF (Timer Off-Delay) — accumulator counts up while the rung is false. Resets to 0 when the rung goes true. “How long has the input been off?”
- RTO (Retentive Timer On-Delay) — accumulator counts up while the rung is true, but holds its value when the rung goes false. Only the explicit
RESinstruction clears it. “How much total time has the input ever been on?”
On-Delay (TON) — The Most-Used Timer
The on-delay timer is a “wait before doing it” device. Energise the rung, the timer starts counting from zero. When the accumulator reaches the preset, the DN bit goes from 0 to 1. Drive an output rung from T4:0/DN and that output will turn on after the configured delay.
Drop the rung at any point before completion and the accumulator resets to zero immediately. There is no “remember where I was”. Press the input again and the count starts over.
When to use TON
Almost any “wait then act” requirement: pre-start warning horn, motor purge cycle, dwell time on a press, debounce filter on a noisy switch, conveyor jam timeout. If you can phrase the requirement as “wait X seconds after Y becomes true, then do Z”, you want a TON.
Off-Delay (TOF) — The Run-On Timer
The off-delay timer holds an output on for a configured time after the input drops. Energise the rung and the timer’s DN bit immediately goes to 1. Drop the rung and the timer starts counting; only when the accumulator reaches the preset does DN drop to 0.
The classic example is a cooling fan on a welding machine or a VFD: while the welder is running, the fan runs. When you stop welding, the fan keeps running for ten more minutes to cool the heat sinks before shutting off. That’s exactly what a TOF gives you with one rung.
Inverted logic warning
TOF runs its accumulator while the rung is false. This trips up beginners — you’ll often see code where someone wired an XIO into a TOF rung and got the opposite of what they expected. Read TOF rungs carefully: “the timer counts during the time the rung is OFF, and DN is true the rest of the time”.
Retentive Timer (RTO) — Counts Total Run Time
The retentive timer is the special case where you want to know the total accumulated time something has been on, regardless of how many on/off cycles happened. Energise the rung, the accumulator counts up. Drop the rung, the accumulator holds its current value. Energise it again, and counting resumes from where it left off.
Because RTO doesn’t auto-reset, you must explicitly clear it with a Reset (RES) instruction wired to the same timer file. The RES instruction zeroes both ACC and DN.
Maintenance counters
The most common RTO use case is a maintenance interval timer. Run an RTO whenever the motor is on, with a preset of, say, 360 000 (100 hours at 1-second base). When DN fires, light a “service required” lamp and log the alarm. The maintenance technician resets the timer with the RES after performing the service. No matter how many times the motor was started and stopped during those 100 hours, you get an alarm at exactly 100 hours of cumulative run time.
Cascading and Reciprocating Timers — Sequences and Oscillators
The real power of timers comes from chaining them together. Two patterns matter most:
Cascading — Step-by-Step Sequences
A cascade uses the DN bit of one timer to enable the next. Timer 1 starts when the cycle begins and runs for, say, 20 seconds. The instant Timer 1’s DN fires, it enables Timer 2 (and disables itself). Timer 2 runs for the next stage. When Timer 2’s DN fires, Timer 3 takes over. And so on.
This is the structure of every traffic light controller, every oven bake-cycle, every laundry machine wash-rinse-spin. You can build sequences of any length this way without ever using a sequencer instruction.
Reciprocating — Free-Running Oscillator
A reciprocating pair has two timers feeding each other in a way that makes them flip-flop. Timer 1’s DN bit kills Timer 1 and starts Timer 2. Timer 2’s DN bit kills Timer 2 and re-enables Timer 1. The result is a continuous square wave whose ON time equals Timer 1’s preset and whose OFF time equals Timer 2’s preset.
You’ll meet this pattern in flashing alarm beacons, intermittent wipers, jog-pulse generators, and “dwell-and-step” motion controllers.
Timer Control Bits as Conditions
The EN, TT, and DN bits aren’t just for the timer that owns them — they’re regular bits in memory and any rung in the program can read them. Common combinations:
XIC T4:0/DN— “the delay is finished, do this now” (most common).XIC T4:0/TT— “the timer is currently running, do this only during the wait” (for a flashing beacon while a delay is in progress).XIO T4:0/DN— “the delay is not yet finished, do this until it is”.XIC T4:0/EN— “the timer is enabled, even if not yet done”.
Watchdog timers
One special use of TON deserves a name of its own: the watchdog timer. Wire it so that the rung is true only while everything is healthy (e.g. “infeed conveyor running”); use a 30-second preset. As long as the conveyor keeps cycling, the timer keeps resetting before DN fires. If the conveyor stalls for more than 30 seconds, DN fires and you trigger an alarm or shutdown. The watchdog catches the absence of activity rather than the presence — invaluable for jam detection.
Worked PLC Programs
Six Programs — From a Five-Second Delay to a Free-Running Oscillator
Each program below takes a real timing problem — a delayed motor, a run-on cooling fan, a maintenance interval, a traffic-light sequence — and turns it into ladder logic. Pay attention to which timer you choose; the wrong one will give you the opposite of what you want.
The problem: when the operator presses START, the conveyor must not turn on immediately. Instead, a warning horn sounds for 5 seconds. After 5 seconds the horn stops and the conveyor motor begins to run. STOP shuts everything off at any time. This is the classic safety pattern — give anyone near the conveyor time to step clear before the belt starts moving.
Inputs & Outputs
INPUTS
I:1/0 — START (NO momentary)
I:1/1 — STOP (NC)
OUTPUTS
B3:0/0 — Cycle_Run (internal seal-in)
O:2/0 — Warning horn
O:2/1 — Conveyor motor
T4:0 — TON, PRE 50 (5.0 s @ 0.1 s base)
Ladder Diagram (Four Rungs)
Rung 0: latch the cycle bit. Rung 1: feed the cycle bit into a TON. Rung 2: horn while TT (still timing). Rung 3: motor when DN (delay finished).
How it works
- Operator presses START. Rung 0 latches
B3:0/0= 1. - Rung 1 sees Cycle = 1, so the TON enables and starts counting from ACC = 0 toward PRE = 50 (5.0 s).
- While counting:
TT= 1,DN= 0. Rung 2 sounds the horn. Rung 3 keeps the motor off. - When ACC reaches 50:
TTdrops to 0,DNgoes to 1. Rung 2 turns the horn off; Rung 3 turns the motor on. - Operator presses STOP. Rung 0 drops Cycle = 0. The TON instantly resets ACC and DN to 0. Both horn and motor drop simultaneously.
TT is true during the wait — perfect for warning lights and horns. DN is true after the wait — perfect for the actual output you wanted to delay. Many real machines use both at once.
The problem: a variable-frequency drive (VFD) must keep its cooling fan running for 10 minutes after the drive itself stops, to dissipate heat from the IGBT modules. Whenever the drive is enabled, the fan runs immediately. Whenever the drive disables, the fan stays on for another 10 minutes, then shuts off. If the drive enables again before those 10 minutes are up, the fan just stays on continuously and the timer is reset.
Inputs & Outputs
INPUT
I:1/0 — Drive_Enable (1 = drive running)
OUTPUTS
O:2/0 — Fan motor
T4:1 — TOF, PRE 600 (10 min @ 1.0 s base)
Ladder Diagram (Two Rungs)
One TOF, one output rung. The DN bit drives the fan — and DN behaves the opposite way you’d guess from a TON.
How it works (the TOF mental model)
- Drive enables (rung 0 goes true). The TOF immediately sets
DN= 1 and resets ACC = 0. The fan turns on instantly via rung 1. - Drive stays on. ACC stays at 0 (TOF only counts while the rung is false), DN stays at 1. Fan keeps running.
- Drive disables (rung 0 goes false). ACC begins counting up from 0 toward PRE = 600.
DNstays at 1 the whole time. Fan keeps running. - Ten minutes pass, ACC reaches 600.
DNdrops to 0. Rung 1 drops the fan. - If the drive re-enables before those 10 minutes finish, ACC resets to 0 and DN stays at 1 — the fan never goes off, and the run-on cycle starts fresh whenever the drive next disables.
The problem: a critical motor needs scheduled maintenance every 100 cumulative hours of run time. We don’t care how many times it’s been started and stopped — only the total time it has spent running. When the cumulative hours reach 100, a “Service Required” lamp turns on. The maintenance technician presses RESET after performing the service, and the counter starts again from zero.
Inputs & Outputs
INPUTS
I:1/0 — Motor_Running feedback (1 = motor on)
I:1/1 — RESET pushbutton
OUTPUTS
O:2/0 — Service_Required lamp
T4:2 — RTO, PRE 360000 (100 h @ 1.0 s base)
Ladder Diagram (Three Rungs)
RTO accumulates run time. DN drives the lamp. RESET button issues a RES that clears the accumulator and the DN bit.
How it works
- Motor runs. Rung 0 is true. RTO accumulator increments by 1 every second.
- Motor stops. Rung 0 goes false. RTO holds the accumulator at its current value — the unique behaviour that makes RTO different from TON.
- Motor restarts later. Counting resumes from where it left off, not from zero.
- Eventually ACC reaches 360000 (100 hours of run time). DN goes to 1. Rung 1 lights the Service_Required lamp.
- Technician performs maintenance, presses RESET. Rung 2 fires the RES instruction, which zeroes both ACC and DN. Rung 1 drops the lamp. Counting begins again from 0.
Why the explicit RES?
The RTO has no way to clear itself. Without a RES, the accumulator just stays at its last value forever — and DN stays latched on. The RES instruction is mandatory whenever you use an RTO. Wire it to a deliberate operator action like a key-protected reset button or an HMI button that requires acknowledgement, never to anything that fires automatically.
The problem: a single-direction traffic signal cycles through three states: RED for 30 s → GREEN for 25 s → YELLOW for 5 s → repeat. The cycle starts when a master enable is on and stops cleanly when the enable drops. Three TONs cascaded so that each one’s DN bit ends its own stage and starts the next.
Inputs & Outputs
INPUT
I:1/0 — System enable
OUTPUTS
O:2/0 — RED lamp
O:2/1 — GREEN lamp
O:2/2 — YELLOW lamp
T4:0 — RED stage, PRE 300 (30 s @ 0.1 s)
T4:1 — GREEN stage, PRE 250
T4:2 — YELLOW stage, PRE 50
The cascade pattern in plain English
- T4:0 (RED stage) runs while: system is enabled AND YELLOW stage is not yet done. So it counts during RED, finishes (DN = 1), then waits while GREEN and YELLOW run.
- T4:1 (GREEN stage) runs while: RED is done AND YELLOW is not yet done. So it starts the instant RED finishes, counts through 25 s, then waits.
- T4:2 (YELLOW stage) runs while: GREEN is done. So it starts the instant GREEN finishes, counts through 5 s, then DN fires.
- The instant T4:2/DN fires, the cycle is over. We use it to reset all three timers simultaneously — and since RES on T4:0 makes its DN go back to 0, the whole chain restarts.
Ladder Diagram (Seven Rungs)
Three timers cascade. The XIO of the next-stage DN bit gates each timer — and a final RES restarts the cycle from the top.
How it works (timeline)
- t=0: Enable goes high. T4:0 starts counting (none of the DN bits are set yet, so XIO YEL DN passes power). RED lamp lights via rung 3.
- t=30 s: T4:0/DN fires. RED stage rung now drops the RED lamp. T4:1 starts counting (RED DN is high, GRN DN is still low so its XIO YEL DN passes). GREEN lamp lights via rung 4.
- t=55 s: T4:1/DN fires. GREEN drops. T4:2 starts counting. YELLOW lamp lights via rung 5.
- t=60 s: T4:2/DN fires. Rung 6 issues RES on T4:0. T4:0’s DN drops to 0, which (cascade-style) drops T4:1 and T4:2 too because their gating XIO/XIC bits flip. Cycle restarts from RED.
The problem: when a fault is active, an alarm beacon must flash on for 0.5 s, off for 0.5 s, continuously, until the fault is cleared. We want a clean square wave with 1 Hz frequency, generated entirely with two timers.
Inputs & Outputs
INPUT
I:1/0 — Fault_Active
OUTPUTS
O:2/0 — Beacon lamp
T4:0 — ON timer, PRE 5 (0.5 s)
T4:1 — OFF timer, PRE 5 (0.5 s)
Ladder Diagram (Three Rungs)
T4:0 runs while T4:1 isn’t done; T4:1 runs while T4:0 IS done. They take turns. The beacon follows T4:0 — on while it’s counting, off while T4:1 is counting.
How it works (the trick of the reciprocating pair)
- Fault becomes active. Both T4:0 and T4:1 are at ACC = 0, DN = 0. Rung 0’s XIO of T4:1/DN passes (DN is 0). T4:0 starts counting. Rung 2’s XIO of T4:0/DN also passes — beacon lights.
- 0.5 s later, T4:0/DN goes to 1. Rung 0’s XIO blocks → T4:0 instantly resets to 0 → DN drops back to 0… but now T4:1 is enabled (rung 1’s XIC of T4:0/DN saw the brief high) and starts counting. Beacon drops because rung 2’s XIO of T4:0/DN sees the brief high.
- 0.5 s later, T4:1/DN goes to 1. Rung 0’s XIO of T4:1/DN now blocks T4:0 from restarting… but the moment T4:1’s rung is broken (because its XIC of T4:0/DN went low again when T4:0 reset), T4:1 also resets. The XIO of T4:1/DN passes again, T4:0 starts counting again. Beacon lights again.
- The pair has settled into a stable 1 Hz oscillation: T4:0 runs for 0.5 s (beacon on), then T4:1 runs for 0.5 s (beacon off), forever — until
I:1/0drops and both rungs go cold.
The problem: a stamping press fires a hydraulic solenoid each time the operator pulls the trigger. The solenoid must extend for exactly 1.5 seconds, then retract — regardless of how long the operator holds the trigger button. Holding the trigger longer should not extend the stroke, and releasing it during the stroke should not cut the stroke short.
Inputs & Outputs
INPUT
I:1/0 — Trigger button (NO momentary)
OUTPUTS
B3:0/0 — Stroke_Active (latch)
O:2/0 — Solenoid
T4:0 — TON, PRE 15 (1.5 s @ 0.1 s)
Ladder Diagram (Three Rungs)
Trigger latches the stroke bit. The TON, fed by the stroke bit, runs for 1.5 s. Its DN unlatches the stroke bit. The solenoid follows the stroke bit, so it’s energised for exactly the timer’s preset.
How it works
- Operator pulls trigger (XIC of
I:1/0goes true). Rung 0 fires the OTE, latchingB3:0/0= 1 via the seal-in branch. - Rung 1 sees the stroke bit go high. T4:0 starts counting. Rung 2 sees the stroke bit and energises the solenoid.
- 1.5 seconds later, T4:0/DN goes high. Rung 0’s XIO of T4:0/DN now blocks — the seal-in chain breaks. Stroke bit drops to 0.
- Rung 1’s input goes false instantly. The TON resets ACC and DN both back to 0. Rung 2 drops the solenoid because the stroke bit is now 0.
- Whether the operator is still pressing the trigger or not, the stroke is over. If they release and re-press, the latch starts a fresh 1.5-second cycle. If they keep holding, nothing happens until they release and re-press.
Common Student Mistakes
Things to watch out for in this chapter:
- Forgetting the time base. A preset of 50 means 50 seconds at a 1.0 s base, but only 5.0 seconds at a 0.1 s base. Always check both fields when a delay seems wrong.
- Reading TOF as if it were TON. TOF’s accumulator counts while the rung is OFF, and DN is true the rest of the time — the opposite of TON. Trace through both states before you trust your code.
- Using TON where you meant RTO. TON resets the accumulator the instant the rung goes false. If you need cumulative time across many on/off cycles, use RTO.
- Forgetting the RES on an RTO. Without an explicit RES, the accumulator stays at its last value forever and DN stays latched on. Every RTO needs a deliberate reset path.
- Putting an RTO on a rung that briefly drops every scan. Even a 1-millisecond drop won’t reset the accumulator — that’s the whole point of RTO — but it will stop the count for that scan. Long-term accuracy of an RTO depends on the input being stably true.
- Driving an output directly from
T4:0/ENwhen you wantedDN. The EN bit mirrors the rung condition (it’s true whenever the timer is enabled, even at ACC = 0). Most of the time you want DN, not EN. - Putting the timer’s contact before the timer in the program. PLCs scan top-to-bottom. If rung 5 reads
T4:0/DNbut the timer itself is in rung 10, your output will be one scan late — typically not noticeable, but it can matter for fast control loops.
Quick Recap
The eight things to take away from Chapter 7:
- Mechanical timing relays — pneumatic dashpots and synchronous-motor cams — were the ancestors of every PLC timer.
- Every software timer has a preset, an accumulator, a time base, and three control bits:
EN,TT, andDN. - TON waits before acting. Use it for delayed starts, dwell times, and debounce.
- TOF hangs on after the input drops. Use it for fan run-on, lubrication oil, and motion-detector lights.
- RTO accumulates time across on/off cycles. Always pair with a RES for explicit reset.
- Cascading chains TONs together to build sequences of any length — traffic lights, oven cycles, recipes.
- Reciprocating two TONs creates a free-running oscillator with independently adjustable on-time and off-time.
- Use timer control bits —
EN,TT,DN— like any other bit. They can drive outputs, gate other timers, or feed comparator instructions.
Review & Self-Assessment
Chapter 7 Review Questions
Try answering each question on your own first. Tap to reveal the answer when you’re done.
Q1What four pieces of data does every timer instruction store?+
EN (enable), TT (timer-timing), and DN (done).Q2Explain the difference between TT and DN.+
Q3A TON has PRE = 200 and time base = 0.1 s. How long is the delay?+
Q4Why must you use RTO instead of TON for a maintenance-hour counter?+
Q5In Program 02 (TOF cooling fan), at what moment does the fan first turn on, and at what moment does it turn off?+
Q6Describe how three cascaded TONs implement a traffic-light sequence.+
Q7In a reciprocating-timer oscillator with both presets equal to 5 (0.1 s base), what is the output frequency?+
Q8When would you choose to drive an output from T4:0/TT instead of T4:0/DN?+
Q9A student writes an RTO without a RES instruction and the maintenance lamp never goes back off after the first service. What’s wrong?+
RES T4:n when the operator presses the maintenance-acknowledge button.Q10Why does a one-shot pulse (Program 6) need a separate latch bit instead of just driving the solenoid directly from a TON’s TT bit?+
T4:0/TT with the TON enabled by the trigger button, the timer’s accumulator would reset the instant the operator released the trigger — cutting the stroke short. The latch bit decouples the trigger from the timer: the latch holds the timer’s input true regardless of the trigger’s state, so the stroke runs for its full preset time even if the operator releases the button immediately.Q11What is a watchdog timer, and how is it different from a normal TON?+
Q12Sketch in words how you’d use a TON to debounce a noisy mechanical pushbutton.+
Need help building a timer-driven sequencer or troubleshooting a timing-related fault?
Get one-on-one tutoring or commissioning help from Dr Ahsan Rahman — Head of Electrical Engineering, with two decades of experience teaching ladder logic and process timing.