Module 08 · Ladder logic basics

Timers: TON, TOF, TP

Delays are everywhere in machines: wait for a valve to open, keep a fan running after the heater stops, sound a horn before a conveyor starts. Three standard timers cover nearly all of them. Watch each one live on a timing chart.

≈ 45 min6 lessons1 hands-on labQuiz · pass 80 %Free

By the end of this module you can

  • Predict the output of on-delay (TON), off-delay (TOF) and pulse (TP) timers from a timing diagram
  • Use a timer's Q (done) bit and elapsed time ET in other rungs
  • Build a flasher and a start-up warning
  • Set timers up in Siemens, Rockwell, Mitsubishi and Logivyx, including their units and presets

Each timer has an input IN, a preset time PT, an output Q and an elapsed time ET. Here all three watch the same push button with PT = 2 s. Try a short press (under 2 s) and a long press (over 2 s), and read the chart.

TimerQ turns ONQ turns OFFTypical use
TON on-delaywhen IN has been 1 for PTas soon as IN goes 0 (ET resets)"Pressure must be OK for 2 s", delayed start, debounce
TOF off-delayas soon as IN goes 1PT after IN goes 0Fan run-on, keep a pump running after stop, hold a signal
TP pulseon the rising edge of INafter exactly PT, whatever IN doesFixed-length pulse: horn, glue shot, ejector

Specifications often describe timing as a diagram. Practise reading it: each question describes IN; choose what Q does.

RememberA TON resets as soon as IN drops. If the delay must add up over several interruptions (total run hours, total heating time), use a retentive timer: TONR (Siemens), RTO (Rockwell), ST/OUTH retentive timers (Mitsubishi), or count time yourself in ST.

Many machines need a blinking lamp. Two TONs in a loop make one: T1 counts the OFF time, then T2 counts the ON time, then T2 resets T1, which resets T2, and it starts again. Change the presets in your head: ON time = T2's PT, OFF time = T1's PT.

Rung 1 needs "NOT T2.Q". Logivyx's Function Block Bit has no NC form, so in the Ladder Designer use a Raw ST condition NOT T2.Q, or copy T2.Q to a bit and use XIO. For a simple blinking lamp, Logivyx also has the system flasher tags _1Hz_Flasher, _2Hz_Flasher and others: no logic needed.

VAR T_Delay : TON; END_VAR
T_Delay(IN := Start_Req, PT := T#5s);
Motor := T_Delay.Q;          // ET = T_Delay.ET

IEC: TON, TOF, TP function blocks with TIME presets (T#500ms, T#2m30s). Logivyx Ladder Designer: drag a Timer (TON/TOF/TP) onto the output side of a rung, give an Instance name, pick the Type and the Preset (seconds). Use its output elsewhere with Function Block Bit (instance + field Q). In ST, timer ET is in milliseconds.

        "IEC_Timer_Delay"
           +--------+
"Start_Req"|  TON   |
--| |------|IN     Q|------( "Motor" )
           |        |
      T#5s-|PT    ET|- "Delay_ET"
           +--------+

S7-1200/1500: TON, TOF, TP and retentive TONR are IEC timers. Each needs an instance: a single-instance DB (e.g. "IEC_Timer_0_DB") or a multi-instance in the calling FB, or a tag of type IEC_TIMER. There are also coil forms -(TON)-. S7-300/400 additionally have the classic S5 timers (S_ODT, S_OFFDT, S_PULSE…) on T numbers with S5T# presets.

XIC Start_Req TON T_Delay 5000 0
XIC T_Delay.DN OTE Motor

Studio 5000: TON, TOF and retentive RTO use a TIMER tag with .PRE and .ACC in milliseconds (DINT) and status bits .EN (enabled), .TT (timing), .DN (done). Reset an RTO with RES. For TOF, .DN is 1 while the rung is true and stays 1 until the off-delay ends: it plays the role of Q. FBD/ST offer TONR/TOFR/RTOR.

LD   X0
OUT  T0  K50       ; on-delay, 50 × 100 ms = 5 s
LD   T0
OUT  Y0

The timer coil OUT T0 K50 is an on-delay timer; the setting is a count of the timer's resolution (100 ms by default for normal timers, so K50 = 5 s; check the timer-limit settings in the CPU parameters). T0 contact closes when time is up, the current value is T0 as a word. ST devices are retentive timers (reset with RST ST0). There is no off-delay or pulse coil: use the IEC function blocks TOF / TP from the GX Works3 standard library, or build them with a TON.

Many conveyors must sound a horn for a few seconds before they move, so nobody is caught by surprise. START begins a request; the horn sounds while a TON times 3 s; then the motor starts and the horn stops.

Use PLC_Trainer. PB1 = START, SW1 = stop circuit OK (on = healthy), Q1 = motor, Q2 = horn, Q3 = fan.

Lab

L08_Timers

  1. New ladder routine L08_Timers. Build the start-up warning: rung 1 seal-in on a new BOOL tag Run_Req (PB1 / Run_Req, then XIC SW1).
  2. Rung 2: XIC Run_Req → Timer, Instance name T_Warn, Type TON, Preset 3 seconds.
  3. Rung 3: XIC Run_Req, XIO Q1 → OTE Q2 (horn). Rung 4: Function Block Bit T_Warn, field Q → OTE Q1 (motor).
  4. Rung 5: XIC Q1 → Timer T_Fan, Type TOF, Preset 10 seconds. Rung 6: Function Block Bit T_Fan.Q → OTE Q3. The fan keeps running 10 s after the motor stops.
  5. Rung 7: XIC SW2 → Raw ST Action N1 := T_Warn.ET; so N1 shows the warning time counting in milliseconds.
  6. Call L08_Timers from Main, save, F5. Check the order: horn 3 s, motor on; switch SW1 off: motor off at once, fan off 10 s later.
  7. Open 🧮 Logic Diag → View Ladder… and watch the timer boxes count.