Popular plc programmingladder logicindustrial automationStructured TextIEC 61131-3PLC tutorial for beginners
Article

PLC Timers Explained: TON, TOF and TP with Ladder Examples

How PLC timers work: TON on-delay, TOF off-delay and TP pulse timers with timing diagrams, ladder examples and the timer settings for Siemens, Rockwell and Mitsubishi.

PLC Timers Explained: TON, TOF and TP, Bob Teaches Tech featured image

PLC timers delay or stretch a signal by a set time. A TON (on-delay) timer turns its output on after its input has been on for the preset time, a TOF (off-delay) timer keeps its output on for the preset time after its input goes off, and a TP (pulse) timer gives a fixed-length pulse every time its input switches on.

These three are the standard timers defined in IEC 61131-3, and every PLC brand has them or an equivalent. In this guide I explain how each one behaves with a timing diagram, show a ladder example for each, and list the settings that catch people out on Siemens, Rockwell and Mitsubishi controllers. You can watch a TON work rung by rung in the Ladder Lab simulator: load the Delayed start with a TON timer program.

What a PLC timer does

A timer is a function block with two inputs and two outputs. The names below are the IEC 61131-3 names, used by Siemens TIA Portal, CODESYS, OpenPLC and most modern software.

Pin Type Meaning
IN BOOL input The condition that starts (or, for TOF, stops) the timer. In ladder this is the rung that feeds the box.
PT TIME input Preset time, for example T#5s or T#250ms.
Q BOOL output The timer output. When it is on depends on the timer type.
ET TIME output Elapsed time. It counts from 0 up to PT.

Older and brand-specific timers use different names for the same idea. On Rockwell (Allen-Bradley) controllers you set .PRE (preset) and read .ACC (accumulated value), plus three status bits: .EN (rung is true), .TT (timer is timing) and .DN (done). On a Mitsubishi FX you write OUT T0 K100, where K100 is a count of time-base ticks, and the T0 contact closes when the time is up.

Each timer needs its own memory. In Siemens that is an instance data block (IEC_TIMER), in Rockwell a TIMER tag, and in Mitsubishi a timer number such as T0. Never use the same timer in two places in a program; I come back to this in the mistakes section.

TON, TOF and TP at a glance

The quickest way to understand PLC timers is to drive all three with the same input and compare the outputs.

Timing diagram comparing TON, TOF and TP PLC timers driven by the same input signal with a 5 second preset time
Figure 1. TON, TOF and TP driven by the same input. Only the timer type changes; PT is 5 s in every case.
Timer Q turns on Q turns off Typical use
TON (on-delay) When IN has been on for PT As soon as IN goes off Delayed start, filtering a noisy sensor, alarm delay
TOF (off-delay) As soon as IN goes on When IN has been off for PT Fan run-on, conveyor clear-out, holding a signal through a short dropout
TP (pulse) On the rising edge of IN When PT has elapsed, whatever IN does Fixed-length pulse to a solenoid, horn or lubricator

TON: the on-delay timer

The TON is the timer you will use most. Here is exactly what it does:

  1. While IN is off, ET is 0 and Q is off.
  2. When IN turns on, ET starts counting up.
  3. When ET reaches PT, Q turns on and ET stops at PT.
  4. When IN turns off, at any time, ET goes back to 0 and Q turns off.

Point 4 is the one to remember. A TON does not remember partial time. If IN is on for 4 s of a 5 s preset and then drops, the next start begins again from zero. That makes the TON a good filter: a level switch that must stay on for 2 s before the PLC believes it will ignore splashes and short bounces.

Example: conveyor delayed start with a warning horn

A common safety requirement is a warning before a conveyor starts, so nobody has a hand on the belt. The operator presses Start, a horn sounds for 5 s, then the belt runs.

Tag Address Device
Start I0.0 Start push button, normally open
Stop I0.1 Stop push button, normally closed
Overload I0.2 Overload relay auxiliary contact 95-96, normally closed
Run_Req M0.0 Internal bit: the operator has asked the conveyor to run
Conveyor Q0.0 Conveyor motor contactor
Warning horn Q0.1 Horn or beacon
Ladder logic for a conveyor delayed start: seal-in run request, TON timer T_Start with 5 second preset, warning horn and conveyor output
Figure 2. Delayed start with a TON timer. The horn sounds while T_Start is timing; the conveyor starts when T_Start.Q turns on.
  • Rung 1 is a normal seal-in circuit that sets the internal bit Run_Req. Stop and Overload are programmed with normally open contacts because the devices are wired normally closed.
  • Rung 2 feeds Run_Req into the TON T_Start with PT = T#5s.
  • Rung 3 sounds the horn while Run_Req is on and the timer is not yet done.
  • Rung 4 runs the conveyor once T_Start.Q is on.
Time Event T_Start.ET T_Start.Q Horn Conveyor
0 s Start pressed 0 s 0 1 0
3 s Timing 3 s 0 1 0
5 s Preset reached 5 s 1 0 1
Any time Stop pressed or overload trips 0 s 0 0 0

Because the timer is fed from Run_Req, pressing Stop during the warning resets the timer as well. The next Start gives the full 5 s warning again, which is what you want.

TOF: the off-delay timer

The TOF works the other way round:

  1. When IN turns on, Q turns on immediately and ET is held at 0.
  2. When IN turns off, ET starts counting and Q stays on.
  3. When ET reaches PT, Q turns off.
  4. If IN comes back on before PT is reached, ET resets to 0 and Q simply stays on.

Look at the TOF line in Figure 1. The input drops at 9 s and comes back at 12 s, inside the 5 s delay, so the output never turns off in between. It only turns off at 19 s, 5 s after the input finally drops at 14 s.

Example: cooling fan run-on

A heater or a VFD panel often needs its cooling fan to keep running for a while after it switches off, to carry away the stored heat. With a TOF that is one rung: the heater output feeds IN, PT is T#60s, and Q drives the fan. The fan starts with the heater and stops 60 s after the heater stops. If the thermostat calls for heat again within that minute, the fan just keeps running.

On Rockwell Logix the TOF uses the same status bits as the TON but in a different pattern: .DN is on while the rung is true and stays on until .ACC reaches .PRE after the rung goes false, so .DN is the bit you use to drive the fan.

Building an off-delay on a Mitsubishi FX

The classic FX series has no TOF instruction; its T timers are all on-delay. You build the off-delay from a TON and a holding contact:

Step Instruction Meaning
0 LD Y0 Fan is running
1 ANI T0 and the run-on time is not finished
2 OR X0 or the heater signal is on
3 OUT Y0 then keep the fan on
4 LDI X0 Heater signal is off
5 AND Y0 and the fan is still running
6 OUT T0 K600 time 60 s (600 × 100 ms)

When X0 drops, Y0 holds itself on and T0 starts timing. After 60 s the T0 contact opens the holding path, Y0 drops, and T0 resets because its rung is no longer true. If X0 comes back during the run-on, T0 resets and Y0 stays on through X0.

TP: the pulse timer

A TP turns a rising edge into a pulse of exactly PT, however long or short the input is:

  1. On the rising edge of IN, Q turns on and ET starts counting.
  2. Q stays on until ET reaches PT, even if IN goes off in the meantime.
  3. The TP is not retriggerable: new rising edges while the pulse is running are ignored.
  4. After the pulse, ET stays at PT while IN is still on and goes back to 0 when IN goes off, ready for the next edge.

A typical job is a reject kicker. A photoelectric sensor sees a bad part for maybe 30 ms, but the reject solenoid needs a clean 500 ms stroke to push it off the belt. In structured text that is two lines:

tKick(IN := Reject_Sensor, PT := T#500MS);
Reject_Valve := tKick.Q;

Rockwell Logix ladder has no TP instruction, and the FX timers are on-delay only. On those controllers you build the pulse from parts: a rising-edge contact on the sensor sets a Pulse bit, the Pulse bit runs a TON with a 500 ms preset, the TON done bit resets the Pulse bit, and the Pulse bit drives the valve. Because the Pulse bit is already set while the pulse runs, extra edges change nothing, so it behaves like a TP.

Retentive timers: when the time must add up

Sometimes you need the time to accumulate across interruptions, for example a curing step that needs 20 minutes of heat in total even if the oven door is opened halfway through. A TON would start again from zero every time the door opened. A retentive timer keeps its elapsed time when IN goes off and only clears it when you reset it.

Brand Retentive timer How you reset it
Siemens S7-1200/1500 TONR R input on the block
Rockwell Logix RTO RES instruction on the same TIMER tag
Mitsubishi FX3U T246–T249 (1 ms), T250–T255 (100 ms) RST T250

Always program the reset. A retentive timer without one works the first time and never again.

PLC timer settings by brand

The behaviour is the same everywhere. What changes is how you enter the preset and how long a timer can run.

Platform Timers Preset format Notes
Siemens S7-1200/1500 (TIA Portal) TON, TOF, TP, TONR TIME value, e.g. T#5s Each call needs an IEC_TIMER instance (single or multi-instance DB)
Rockwell CompactLogix / ControlLogix TON, TOF, RTO .PRE in milliseconds (5000 = 5 s) TIMER tag holds .PRE, .ACC, .EN, .TT, .DN
Mitsubishi FX3U T0–T199 100 ms, T200–T245 10 ms, T256–T511 1 ms K value in ticks (K50 = 5 s on a 100 ms timer) K is 16-bit, so a 100 ms timer tops out at 3,276.7 s
CODESYS / OpenPLC TON, TOF, TP TIME value, e.g. T#5s Standard library function blocks, one instance per use

For tick-based timers the formula is preset = time ÷ time base. Ten seconds on a 100 ms timer is K100; on a 10 ms timer it is K1000. The PLC timer preset calculator does the conversion for any time base and shows the working.

Here is that K100 case on a Mitsubishi FX in simulation mode, from my original version of this tutorial:

Mitsubishi FX ladder logic on-delay timer in simulation with a K100 preset driving output Y001
Figure 3. An FX on-delay timer with a K100 preset (10 s on a 100 ms timer) running in simulation.

If you use GX Developer or GX Works2, my Mitsubishi GX Developer timer tutorial walks through entering and monitoring timers step by step.

Watch the video

Six PLC timer mistakes to avoid

  1. Using one timer in two places. Two rungs writing to the same T0, or two calls of the same IEC_TIMER instance, fight each other every scan. The timer seems to reset at random. Give every use its own timer.
  2. Expecting a TON to remember time. If the input can drop part way, a TON starts again from zero. Use a retentive timer if the time must add up.
  3. Getting the time base wrong. K50 is 5 s on a 100 ms timer but 0.5 s on a 10 ms timer. On Rockwell, 5 is 5 ms, not 5 s.
  4. Putting a timer where it is not scanned. A timer inside a jumped section or a subroutine that is not called stops updating. On the FX, use T192–T199 for timers in subroutines and interrupt routines.
  5. Expecting millisecond accuracy. A timer can only be as accurate as its time base and the scan time. A 100 ms timer that is checked once per 20 ms scan can be late by a tick plus a scan. For precise timing use a high-speed counter or a hardware feature.
  6. Using a timer for safety. Guard door delays and emergency stop timing belong in a safety relay or safety PLC with certified timing, not in standard PLC logic.

Where to go next

The timer definitions here follow IEC 61131-3. For a clear vendor write-up of the standard TP behaviour, see Kollmorgen’s TP function block reference.

Frequently asked questions

What is the difference between TON and TOF?

A TON delays the output turning on: Q comes on only after the input has been on for the preset time. A TOF delays the output turning off: Q comes on with the input and stays on for the preset time after the input goes off.

What are the three types of PLC timers?

IEC 61131-3 defines three standard timers: TON (on-delay), TOF (off-delay) and TP (pulse). Most brands also offer a retentive on-delay timer, called TONR on Siemens and RTO on Rockwell.

What is a TP timer used for?

A TP produces a pulse of fixed length from a rising edge, whatever the length of the input signal. It is used to give solenoids, horns, lubricators and reject kickers a clean, repeatable on-time.

How do I calculate a PLC timer preset?

For tick-based timers, divide the time you want by the time base: 10 s on a 100 ms timer is a preset of 100 (K100). Siemens, CODESYS and other IEC platforms take the time directly, for example T#10s. Rockwell Logix presets are in milliseconds.

What is the difference between TON and RTO?

A TON resets its accumulated time whenever its rung goes false. An RTO (retentive timer on) keeps the accumulated time when the rung goes false and continues from there next time, so it needs a separate RES instruction to clear it.

Keep going

Want the next tutorial in your inbox? Join the newsletter, one practical tutorial a week, or download the free eBook Introduction to Ladder Logic Programming and I/O Configuration from the resources library.

About The Author