Timer Operations
TP, TON, TOF, TONR & Controls
Timers are essential to every automation project — from simple delays to complex sequence control. Master every timer instruction in TIA Portal with this complete guide.
What Are Timer Operations in TIA Portal?
Timer operations in TIA Portal implement time-based control logic. They are IEC 61131-3 compliant function blocks that measure elapsed time, generate pulses, and create on/off delays. Every timer has an input (IN), a preset time (PT), an elapsed time output (ET), and a status output (Q).
TIA Portal provides 4 IEC timer types (TP, TON, TOF, TONR) plus control instructions for starting, resetting, and loading timers. Each timer instance needs its own instance data block (IDB) or can be used as a multi-instance within an FB.
IEC Timer Types
The 4 standard timer function blocks — each with a different timing behavior
TP — Generate Pulse
What It Does
Generates a pulse of a fixed duration. When IN transitions from FALSE to TRUE, the output Q goes TRUE and stays TRUE for exactly the preset time PT, regardless of what happens to IN. The elapsed time ET counts up from T#0s to PT. Once PT is reached, Q goes FALSE and ET is reset.
When to Use It
When you need a fixed-duration output pulse triggered by an event. Examples: activate a buzzer for exactly 3 seconds when an alarm triggers, pulse a solenoid for a precise duration, create a fixed-width signal for downstream equipment.
Pro Tips
TP is non-retriggerable — a new rising edge on IN while Q is already TRUE has no effect. The pulse runs to completion. To make it retriggerable, reset the timer first.
The output Q does NOT follow IN. Even if IN goes FALSE during the pulse, Q stays TRUE until PT expires.
In SCL: myTP(IN := trigger, PT := T#3s); IF myTP.Q THEN ... END_IF;
TON — Generate On-Delay
What It Does
Delays the activation of an output. When IN goes TRUE, the timer starts counting. After the preset time PT has elapsed, Q goes TRUE. If IN goes FALSE before PT is reached, the timer resets and Q stays FALSE. Q stays TRUE as long as IN remains TRUE after the delay.
When to Use It
The most commonly used timer in PLC programming. Use for: motor start delays, sensor debouncing (ignore signals shorter than X ms), alarm delays (only trigger alarm if condition persists for N seconds), startup sequences.
Pro Tips
TON is the 'classic' delay timer. Think of it as: 'wait X seconds, then turn on — but only if the condition is still true'.
When IN goes FALSE, Q immediately goes FALSE and ET resets to T#0s. There is no off-delay behavior.
For sensor debouncing, use a short PT like T#50ms or T#100ms. This filters out electrical noise and contact bounce.
TOF — Generate Off-Delay
What It Does
Delays the deactivation of an output. When IN goes TRUE, Q immediately goes TRUE. When IN goes FALSE, the timer starts counting. After PT has elapsed, Q goes FALSE. If IN goes TRUE again before PT expires, the timer resets and Q stays TRUE.
When to Use It
When an output should stay on for a while after its input turns off. Examples: keep a cooling fan running for 30 seconds after a motor stops, keep a light on for 60 seconds after motion is no longer detected, maintain a lubrication pump active after a cycle ends.
Pro Tips
TOF is the opposite of TON: Q activates immediately but deactivates with a delay.
If IN goes TRUE→FALSE→TRUE before PT expires, the timer resets. Q never went FALSE — it's a 'keep-alive' behavior.
Common in HVAC: keep the ventilation running for 5 minutes after the process stops to clear residual fumes.
TONR — Time Accumulator
What It Does
An accumulating on-delay timer. Like TON, but the elapsed time ET is NOT reset when IN goes FALSE. ET pauses when IN is FALSE and resumes counting when IN is TRUE again. Q goes TRUE when ET reaches PT. The timer must be explicitly reset using the R input.
When to Use It
When you need to measure total accumulated run time across intermittent operations. Examples: track total motor running hours for maintenance scheduling, measure total exposure time in a curing process that may pause, aggregate operational time for billing or SLA reporting.
Pro Tips
TONR has an additional R (Reset) input. Set R=TRUE to clear ET back to T#0s and Q to FALSE. This is the only way to restart the accumulator.
Unlike TON/TOF/TP, TONR remembers its elapsed time. Power cycle behavior depends on the instance DB's retentive settings.
Use TONR for maintenance counters: when total run time exceeds X hours, trigger a 'maintenance required' alarm.
Timer Control Instructions
Start, reset, and configure timers from LAD/FBD
—(TP)— Start Pulse Timer
—(TP)—What It Does
A coil-style instruction that starts a TP (pulse) timer directly from a LAD rung. When the RLO transitions from FALSE to TRUE, the associated TP timer generates a pulse. This is an alternative to using the TP function block box.
When to Use It
When you prefer the coil notation in LAD instead of a function block box. Some programmers find it cleaner to write timer logic as a rung ending with a timer coil rather than inserting a large FB box in the middle of the network.
Pro Tips
The coil version references the same IEC timer instance as the box version. They are interchangeable.
Place at the end of a rung, just like an output coil. The preset time is configured in the timer instance.
In most modern projects, the FB box version is preferred because it shows all parameters (IN, PT, Q, ET) visually.
—(TON)— Start On-Delay Timer
—(TON)—What It Does
A coil-style instruction that starts a TON (on-delay) timer. When the RLO is TRUE, the associated TON timer counts. When the preset time is reached, the timer output Q becomes TRUE.
When to Use It
Alternative coil notation for TON. Use when you want compact LAD representation of a delay timer without the larger FB box.
Pro Tips
Same behavior as the TON function block — just a different visual representation in LAD.
The timer instance DB stores all parameters: PT, ET, Q, IN.
You can read the timer's Q and ET outputs in other networks by referencing the instance DB.
—(TOF)— Start Off-Delay Timer
—(TOF)—What It Does
A coil-style instruction that starts a TOF (off-delay) timer. The timer output Q activates immediately when the RLO is TRUE, and stays TRUE for the preset time after the RLO goes FALSE.
When to Use It
Alternative coil notation for TOF. Use for off-delay logic in compact LAD rungs.
Pro Tips
Same behavior as the TOF function block.
Commonly used for 'run-on' timers: keep outputs active for a period after the trigger disappears.
Reference the instance DB's Q output in other networks to use the delayed-off signal.
—(TONR)— Time Accumulator
—(TONR)—What It Does
A coil-style instruction for the TONR (accumulating on-delay) timer. The elapsed time accumulates while the RLO is TRUE and pauses when FALSE. The timer must be explicitly reset.
When to Use It
Alternative coil notation for TONR. Use when tracking cumulative run time in LAD format.
Pro Tips
Remember to use the RT (Reset Timer) instruction to reset the accumulator when needed.
The accumulated time is stored in the instance DB and persists across scan cycles.
Useful for maintenance scheduling — trigger an alarm when total accumulated time exceeds a threshold.
—(RT)— Reset Timer
—(RT)—What It Does
Resets a timer to its initial state. When the RLO is TRUE, the specified timer's elapsed time ET is set to T#0s and the output Q is set to FALSE. Works with all timer types (TP, TON, TOF, TONR).
When to Use It
When you need to force-reset a timer from a separate network. Essential for TONR (which doesn't auto-reset), but also useful for resetting any timer on a specific condition like a fault acknowledgment or mode change.
Pro Tips
For TONR timers, RT is the ONLY way to reset the accumulated time. Without it, the timer never resets.
You can reset a timer from any network — it doesn't have to be in the same network as the timer start.
Use RT on a 'reset all' button to clear multiple timers at once.
—(PT)— Load Time Duration
—(PT)—What It Does
Loads a new preset time value (PT) into an existing timer instance at runtime. When the RLO is TRUE, the timer's preset time is updated to the specified value. This allows you to dynamically change timer durations without modifying the program.
When to Use It
When timer durations need to be adjustable from an HMI or recipe system. For example: an operator sets a dwell time on the HMI, and PT loads that value into the process timer. Also useful for adaptive timing based on sensor feedback.
Pro Tips
PT loads the value when RLO is TRUE. If the timer is already running, the new PT takes effect on the next timer start.
Use with HMI-editable variables to let operators adjust timing without engineering access.
The time value format is TIME (e.g., T#5s, T#1m30s, T#500ms). You can also use a TIME variable.
Legacy Timer Instructions
S5 timers from S7-300/400 — available for backward compatibility only
TIA Portal also includes legacy S5 timer instructions (S_PULSE, S_PEXT, S_ODT, S_ODTS, S_OFFDT) for backward compatibility with S7-300/400 programs. For new projects, always use the IEC timers (TP, TON, TOF, TONR) as they are more flexible, portable, and maintainable.
Timer Comparison — Which One to Use?
Quick decision guide based on your timing requirement
| You Need... | Use This Timer | Example |
|---|---|---|
| Fixed-duration output pulse | TP | Buzzer sounds for 3s on alarm |
| Delayed activation (debounce) | TON | Motor starts 5s after button press |
| Delayed deactivation (run-on) | TOF | Fan runs 30s after motor stops |
| Accumulated run time tracking | TONR | Maintenance alarm after 1000h total |
| Force-clear any timer | RT | Reset all timers on fault ack |
| Change timer duration at runtime | PT | Operator adjusts dwell time from HMI |
Frequently Asked Questions
What is the difference between TP and TON?
TP generates a fixed-duration pulse that runs to completion regardless of the input — once triggered, the output stays ON for exactly PT, even if the input goes FALSE. TON requires the input to stay TRUE for the entire duration — if the input goes FALSE before PT, the timer resets and the output never activates.
Can I change a timer's preset time while it's running?
You can load a new PT value using the PT instruction, but it typically takes effect on the next timer start, not the current run. To change timing mid-run, you'd need to reset the timer and restart it with the new PT value.
How do I make a repeating pulse (clock generator)?
Use two timers: a TON for the ON time and a TON for the OFF time, cross-connected. When Timer1 expires, it starts Timer2 and resets itself. When Timer2 expires, it starts Timer1 and resets itself. This creates a continuous oscillating signal with configurable ON/OFF durations.
Are timers retentive across power cycles?
By default, timer instances are NOT retentive — they reset to zero on power-up. To make a timer retentive (e.g., TONR for maintenance hours), set the instance DB to 'retentive' in its properties. Be careful: retentive timers resume counting from their last value after a power cycle.