IEC timers in Siemens SCL are standard timer function blocks based on the IEC 61131-3 programming standard. This international standard defines common programming languages for programmable logic controllers (PLCs), promoting structured, portable, and maintainable industrial automation software.
Structured Control Language (SCL) is a high-level text-based programming language used in Siemens PLCs. It is similar in syntax to the PASCAL language and is ideal for writing complex logic with conditional statements, mathematical operations, loops, and functional programming structures. SCL is defined under the standard DIN EN 61131-3 (IEC 1131-3).
Within SCL, IEC timers like TP (Pulse Timer), TON (On-Delay Timer), and TOF (Off-Delay Timer) are implemented as function blocks. These function blocks are critical when handling time-dependent control processes such as delaying start operations, triggering timed outputs, and creating safe timing sequences for actuators, motors, alarms, and other field devices.
Unlike Ladder Logic (LAD), where timers are represented graphically with coil-like symbols, in SCL the timers are written using function block syntax with clearly defined parameters. Each timer block accepts input parameters and returns output values based on the configured preset time and input signal.
Although Siemens also provides basic timers (like S5T-based TON, TOF, TP) in LAD and FBD, the IEC timers in SCL are more flexible, accurate, and scalable for modern automation applications. These timers are independent of CPU cycle scan time and provide structured parameterized behavior with real-time feedback.
Using IEC timers in SCL offers:
In Siemens Structured Control Language (SCL), timers such as TON, TOF, and TP are used as function blocks that operate based on clearly defined parameters. Understanding these parameters is essential for writing efficient and reliable time-based logic in automation systems.
Below is a detailed explanation of the most commonly used parameters in Siemens SCL timer blocks:
All timer parameters in SCL must be declared and connected correctly. Using improper data types or time formats can lead to compile-time errors or unexpected timer behavior during PLC runtime. Always ensure that the timer instance is declared properly in the variable declaration section or as part of a user-defined data block.
Using these parameters effectively allows you to design time-based control sequences such as motor delays, alarm triggers, pulse generation, or interlock controls with high precision and reliability.
In Siemens SCL (Structured Control Language), you can assign time values using the TIME data type. This is important when working with timers like TON, TOF, TP, or TONR.
To assign a time value to a tag, use the syntax:
my_time := T#10s;
Here, my_time is a variable of type TIME, and T#10s represents 10 seconds. You can also use other time formats such as milliseconds (ms), minutes (m), or hours (h).
Make sure the variable is declared as TIME. Assigning a time value to a variable with the wrong data type will cause a compile error.
The TIME data type in Siemens SCL represents durations in milliseconds and is used in timers like TON, TOF, and TP. It allows accurate time control in automation.
TIME values are 32-bit signed integers stored in milliseconds. You can input durations using the format T# or TIME# followed by units:
Valid range:
T#-24d_20h_31m_23s_648ms to T#+24d_20h_31m_23s_647ms
You can use any combination of units. Only the required parts need to be defined.
The Pulse Timer (TP) in Siemens SCL is used to turn ON an output for a fixed time when it detects a rising edge (when input changes from 0 to 1). Once started, the output stays ON for the set time, no matter what happens to the input during that time.
After the time finishes, the output turns OFF automatically. You can also monitor how much time has passed using the ET (Elapsed Time) output.
In the example below, the timer runs for 10 seconds after the input "start_timer" turns ON:
Once the timer starts, "tp_out" stays ON for exactly 10 seconds, even if "start_timer" turns OFF before that. After 10 seconds, "tp_out" turns OFF, and "tp_et" resets.
The ON Delay Timer (TON) is used to delay turning ON an output. When the input signal becomes TRUE (ON), the timer starts counting. Only after the full set time (PT) has passed, the output becomes TRUE.
If the input turns OFF before the time is complete, the timer resets, and the output stays OFF. The timer only works when a rising edge (0 to 1) is detected at the input.
In the example below, the output #ton_out will turn ON after 10 seconds of the input "start_timer" being TRUE:
If "start_timer" turns ON, the timer starts. If it stays ON for 10 seconds, "#ton_out" becomes TRUE. If "start_timer" turns OFF before 10 seconds, the timer resets, and "#ton_out" stays FALSE.
The Off-Delay Timer (TOF) is used to delay turning OFF an output. When the input is TRUE, the output is immediately TRUE. When the input turns OFF, the timer starts counting. The output stays ON during this delay and turns OFF only after the full preset time (PT) has passed.
In the example below, the output #tof_out will remain ON for 20 seconds after the input "start_timer" turns OFF:
When "start_timer" is TRUE, "#tof_out" is also TRUE. Once "start_timer" becomes FALSE, the timer starts, and "#tof_out" stays ON for 20 seconds. After 20 seconds, "#tof_out" turns OFF automatically.
The Time Accumulator timer is used to measure and accumulate the total time the input is ON within a preset period (PT). Each time the input IN becomes TRUE, the timer runs and adds to the accumulated time. The result is shown in the ET output.
If the total ON time reaches the preset time PT, the output Q becomes TRUE and stays TRUE, even if the input turns OFF. The accumulated time in ET keeps increasing only while IN is TRUE.
To reset the timer manually, you can use the R input, which clears both ET and Q, regardless of the current input state.
Below is an example of using the Time Accumulator timer:
IEC_Timer_0_DB_4.TONR( IN := "start_timer", PT := T#15s, Q => #tonr_out, ET => #tonr_et, R := "reset_timer" );
Each time this timer is used, a separate IEC timer data block should be assigned to store its internal values. Also, for correct behavior, make sure to connect the outputs Q or ET; otherwise, they won’t be updated.