Timers in Structured Text (ST) Programming for RSLogix 5000 PLCs

Published on Aug 19, 2025 | Category: Timer

Share this Page:

In Studio 5000, three types of timers are available in Structured Text: Timer On Delay with Reset (TONR), Timer Off Delay with Reset (TOFR), and Retentive Timer On with Reset (RTOR). These timers operate with a base time unit of 1 millisecond, allowing precise control in automation tasks. In Structured Text, each timer is available as a statement with input and output parameters such as preset value, accumulator value, and reset conditions. Since Structured Text is a statement- and condition-based programming language for industrial control systems, declaring timers correctly is one of the most important steps in RSLogix 5000 programming. For all these timers, the data type used is FBD_TIMER, which must be declared before using timer functions.

Unlike Ladder Logic, these advanced timer instructions are unique to Structured Text and give programmers more flexibility in handling time-based operations. For example, a TONR (Timer On Delay with Reset) can be used to start a motor only if a condition remains true for a specific time, while a TOFR (Timer Off Delay with Reset) can keep a process running for a short delay even after a condition is removed. The RTOR (Retentive Timer On with Reset) is useful in applications where accumulated time must be retained across multiple cycles, such as tracking machine runtime or monitoring batch process durations.

In this page, you will learn how to declare and program timers in Structured Text within RSLogix 5000. We will cover the syntax, input and output parameters, and examples for TONR, TOFR, and RTOR. By the end, you will understand how these timers simplify complex timing logic, provide precise control, and enhance your Allen-Bradley PLC programs beyond what is possible with Ladder Logic.

How Many Timers in Structured Text for RSLogix 5000?

In Structured Text (ST) for RSLogix 5000 (Studio 5000), there are three main types of timers available:

These timers are not the same as ladder logic timers (TON, TOF, RTO). Instead, they are implemented as functions in Structured Text and must be declared with the data type FBD_TIMER. All timers in ST work with a base time unit of 1 millisecond, making them suitable for high-precision control.

How to Define Timers in Structured Text

In Structured Text programming, timers are used to delay actions, hold outputs for a specific duration, or accumulate time across cycles. To define a timer in RSLogix 5000 / Studio 5000, you first need to create a tag and set its Data Type to FBD_TIMER. Once the timer tag is created, you can use its input and output parameters to control how it behaves in your logic.

img/rslogix5000-st-timer/how-to-define-timers-in-studio-5000-structured-text.webp

Input Parameters of a Timer

Output Parameters of a Timer

Unlike Ladder Logic, where timers are placed as graphical blocks, in Structured Text timers are statement-based. This allows you to integrate them directly into IF statements, FOR loops, or other logical constructs, giving you much more flexibility for advanced PLC programming.

Studio 5000 Structured Text Timer On Delay with Reset (TONR)

The Timer On Delay with Reset (TONR) is a non-retentive timer in Structured Text. This means that when the TimerEnable input is set to 1 (true), the timer starts counting in 1 millisecond units until it reaches the defined preset value (PRE). Once the accumulated time (ACC) equals or exceeds the preset, the DN (done) bit is set to true. If the Reset input is activated, the timer immediately resets ACC to zero and clears the DN bit.

img/rslogix5000-st-timer/studio-5000-structured-text-timer-on-delay-with-reset.webp

Explanation of Example

In simple words, the TONR works like a stopwatch that starts counting when enabled and stops when it reaches the preset time. It’s commonly used in PLC programming for delayed start operations, safety delays, or sequencing logic in industrial automation.

Studio 5000 Structured Text Retentive Timer On with Reset (RTOR)

Retentive Timer On with Reset (RTOR) is a retentive timer. Its working principle and structure are similar to the Timer On Delay with Reset (TONR), but the main difference is that RTOR stores the accumulated time value when TimerEnable changes from 1 to 0. When the timer is enabled again (TimerEnable goes from 0 to 1), it resumes execution from the stored value instead of resetting. This makes RTOR useful when you need to hold accumulated time during power loss or stop conditions.

img/rslogix5000-st-timer/studio-5000-structured-text-retentive-timer-on-with-reset.webp

In the example below, the RTOR function is declared using the statement RTOR(RTOR_01);. Here, RTOR_01 is the tag name for the timer, and its type is FBD_TIMER.

The line RTOR_01.TimerEnable := TIMER_INPUT; is used to enable the timer when the input condition TIMER_INPUT is set to 1. Once enabled, the timer begins its operation. The preset value is defined using RTOR_01.PRE := 10000;, which means the timer will run for 10,000 msec (10 seconds) before completing.

If RTOR_01.Reset := TIMER_Reset; is set to 1, the timer is reset, clearing the accumulated value (ACC) and resetting its state. The done bit (DN) indicates when the accumulated time reaches or exceeds the preset value. This is represented in the line TIMER_STATE := RTOR_01.DN;. The accumulated time itself is stored in Timer_acc := RTOR_01.ACC;, which allows the timer to resume from the stored value if the TimerEnable is turned off and then back on.

Studio 5000 Structured Text Timer Off Delay with Reset (TOFR)

The Timer Off Delay with Reset (TOFR) is a non-retentive timer, similar to the TONR. The difference is in its execution: when TimerEnable changes from 1 to 0, the TOFR begins timing until it reaches the preset value. This instruction is used to delay the reset of an output after the enabling condition turns off. The TOFR timer operates in 1 msec time units, and its input/output parameters are the same as the TONR.

img/rslogix5000-st-timer/studio-5000-structured-text-timer-off-delay-with-reset.webp

In the example above, the line TOFR(TOFR_01); declares the TOFR function with the tag name TOFR_01 of type FBD_TIMER. If TOFR_01.TimerEnable is set to 1, the timer does not run. When TimerEnable changes from 1 to 0, the TOFR starts timing, and the ACC (accumulated value) increases until it becomes greater than or equal to TOFR_01.PRE. Once this condition is met, the DN (done bit) is set, and the output delay action is complete.