Machines are full of delays: start the lubrication pump 5 seconds before the main motor, keep the cooling fan running for 2 minutes after the oven stops, flash a beacon once a second. All of that is done with timers.
The parts of a timer
- Preset (PT or PRE): the time you want, for example 5 s.
- Accumulated value (ET or ACC): how much time has passed so far.
- Done bit (Q or .DN): turns on when the accumulated value reaches the preset. You use its contacts in other rungs.
- Time base: the resolution of the timer, for example 100 ms or 10 ms.
On-delay timer (TON)
The most common timer. While the rung is true it times; when the time is reached, the done bit comes on; when the rung goes false, it resets immediately, done bit and all.
| Rung (input) | Accumulated time | Done bit |
|---|---|---|
| Goes true | Starts counting up from 0 | Off |
| Still true, time reaches preset | Stops at preset | On |
| Goes false at any point | Reset to 0 | Off |
Delayed start: the conveyor starts 5 seconds after the pump.
LD X0 ; START
OR Y0
ANI X1 ; STOP
OUT Y0 ; PUMP
LD Y0
OUT T0 K50 ; 5 s on a 100 ms timer
LD T0
OUT Y1 ; CONVEYOR
Program listing (IL)
LD X0
OR Y0
ANI X1
OUT Y0
LD Y0
OUT T0 K50
LD T0
OUT Y1Setting the preset
On IEC-style PLCs (Siemens, CODESYS, Allen-Bradley Micro800) you type the time directly: PT := T#5s. On Mitsubishi FX the preset is a count of time-base units: timers T0–T199 count in 100 ms steps, so 5 seconds is K50. Allen-Bradley Logix timers count in milliseconds, so 5 seconds is a preset of 5000.
PLC timer preset
Seconds to K value for any time base
Formula and notes
K = time (ms) / time base (ms)
Example: 5 s on a 100 ms timer is K50. Siemens S7 TON timers take a time value directly (e.g. T#5S).
Off-delay timer (TOF)
The TOF does the opposite: its output turns on immediately when the rung goes true, and stays on for the preset time after the rung goes false. Classic use: keep a cooling fan or a conveyor running for a while after the main motor stops, so it clears.
Some PLCs, such as the Mitsubishi FX, have no TOF instruction. You build one from a TON on the inverted signal, which is good practice in thinking with timers.
Pulse timer (TP)
IEC PLCs also have a pulse timer: a rising edge on its input produces an output pulse of exactly the preset length, however long the input stays on. Useful for a fixed-length horn blast or a lubrication shot.
Retentive timer (RTO, TONR)
A retentive timer keeps its accumulated time when the rung goes false, and carries on from there next time. It only clears when a separate RESET instruction runs. Use it for totals: “change the filter after 500 hours of pump running time”, whether those hours come in one run or a hundred.
Timer patterns you will reuse
1. Flasher
Two timers resetting each other make a steady on/off signal for beacons and fault lamps.
Program listing (IL)
LD X0
ANI T1
OUT T0 K6
LD T0
OUT T1 K6
LD T0
OUT Y02. Sequence with chained timers
Each timer starts when the previous one is done; the last one breaks the first rung for a scan and restarts the cycle. Traffic lights are the textbook example:
Program listing (IL)
LD X0
ANI T2
OUT T0 K40
LD T0
OUT T1 K15
LD T1
OUT T2 K40
LD X0
ANI T0
OUT Y0
LD T0
ANI T1
OUT Y1
LD T1
ORI X0
OUT Y23. Debounce
A level switch on a sloshing tank flickers. Requiring the input to stay on for 2 seconds (an on-delay on the input) before acting on it stops a pump from short-cycling.
Every timer address must be used only once. Two rungs driving the same timer fight each other every scan, and the timer never reaches its preset.
Frequently asked questions
What is the difference between TON and TOF?
A TON delays turning ON: its output comes on after the preset time with the input true. A TOF delays turning OFF: its output goes off after the preset time once the input goes false.
How do I set 5 seconds on a Mitsubishi FX timer?
Timers T0 to T199 use a 100 ms time base, so the preset is K50 (50 × 100 ms = 5 s).
