PLC timers and counters
Timers and counters turn simple on/off logic into real machine sequences: wait 3 seconds before starting the conveyor, keep the fan running 30 seconds after stop, stop the line after 12 parts.
On-delay timer (TON)
When its input turns on, a TON starts counting. When the elapsed time reaches the preset, the done output turns on. If the input turns off at any time, the timer resets to zero.
Input ___|‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾|____
Done ________|‾‾‾‾‾‾‾‾‾‾|____
|<- PT ->|
Uses: start delay, debouncing a sensor, "sensor blocked for more than 5 s = jam alarm".
Off-delay timer (TOF)
The output turns on immediately with the input, and stays on for the preset time after the input turns off.
Input ___|‾‾‾‾‾‾|_____________
Done ___|‾‾‾‾‾‾‾‾‾‾‾‾‾|______
|<- PT ->|
Uses: run a cooling fan after a motor stops, keep a conveyor running until the last part clears.
Pulse timer (TP)
A rising edge on the input gives an output pulse of fixed length, however long the input stays on. Uses: a fixed glue shot, a 1-second horn blast.
How each brand writes timers
| Brand | Example | Notes |
|---|---|---|
| Siemens | TON, PT := T#3s | IEC timers with instance data; outputs Q and ET |
| Mitsubishi | OUT T0 K30 | K30 = 30 × 100 ms = 3 s; contact T0 is the done bit |
| Allen-Bradley | TON T4:0 preset 3000, base 0.001 | bits .EN, .TT, .DN |
| TOYOPUC | TMR T000 | contact T000 is the time-up bit |
Up counter (CTU)
A CTU adds one on every rising edge of its count input. When the count reaches the preset, the done bit turns on. A separate reset input sets the count back to zero. Counters keep their value when the input turns off; that is the difference from a timer.
Example: a photo-eye counts boxes; at 12 the counter's done bit stops the conveyor and lights "carton full"; the operator's reset button clears it.
Down counter (CTD) and up/down (CTUD)
A CTD counts down from a preset to zero; a CTUD has both count inputs, for example parts entering and leaving a buffer.
Common mistakes
- Expecting a TON to keep timing when its input flickers: it resets on every drop. Debounce the input or use a retentive timer (RTO / TONR).
- Forgetting to reset a counter, so it is "done" forever.
- Counting a signal that is faster than the scan time. Use a high-speed counter.
Try the traffic light and part counter examples in the PLC Sim Lab Playground to watch timers and counters run live.
Try it yourself. Wire sensors, contactors and a PLC, write ladder logic and press RUN in the free PLC Sim Lab Playground. Nothing to install.
Open the Playground →Guided lessons →