Bird
Raised Fist0
PLC Programmingscripting~15 mins

Retentive timer (RTO) behavior in PLC Programming - Deep Dive

Choose your learning style10 modes available
Overview - Retentive timer (RTO) behavior
What is it?
A retentive timer (RTO) is a special timer used in programmable logic controllers (PLCs) that keeps track of elapsed time even if the timer is paused or the controlling condition is removed. Unlike regular timers that reset when turned off, an RTO remembers how much time has already passed and continues from there when restarted. This makes it useful for processes that need to accumulate time over multiple cycles or interruptions.
Why it matters
Without retentive timers, processes that pause or stop would lose their timing progress, causing errors or inefficiencies. For example, if a machine needs to run for a total of 10 minutes but stops halfway, a normal timer would reset, forcing the process to start over. Retentive timers solve this by remembering elapsed time, ensuring accurate timing and smoother automation.
Where it fits
Before learning about retentive timers, you should understand basic PLC programming concepts and standard timers. After mastering RTOs, you can explore advanced timer functions, sequencing, and fault-tolerant automation strategies.
Mental Model
Core Idea
A retentive timer remembers elapsed time across pauses and resumes timing from where it left off.
Think of it like...
It's like a stopwatch that you can stop and start multiple times, and it keeps adding up the total time instead of resetting each time you pause it.
┌───────────────┐       ┌───────────────┐       ┌───────────────┐
│ Timer Start   │──────▶│ Timer Running │──────▶│ Timer Paused  │
│ (Input ON)    │       │ (Counting)    │       │ (Input OFF)   │
└───────────────┘       └───────────────┘       └───────────────┘
         ▲                                              │
         │                                              ▼
         └─────────────────────────────── Timer Resumes (Input ON) ──────▶
Build-Up - 7 Steps
1
FoundationBasic timer concept in PLCs
🤔
Concept: Learn what a timer does in a PLC and how it measures time.
A timer in a PLC counts time when its input condition is true. For example, if a timer is set for 5 seconds, it will count up to 5 seconds while the input is ON. When the input turns OFF, the timer resets to zero and stops counting.
Result
The timer output becomes true after the preset time elapses while the input is ON.
Understanding how a basic timer works is essential because retentive timers build on this idea but add memory of elapsed time.
2
FoundationDifference between standard and retentive timers
🤔
Concept: Introduce the key difference: memory of elapsed time.
Standard timers reset their count to zero when the input turns OFF. Retentive timers, however, keep the elapsed time stored even if the input turns OFF, and continue counting from that stored value when the input turns ON again.
Result
Retentive timers accumulate time over multiple ON periods without losing progress.
Knowing this difference helps you choose the right timer type for processes that pause and resume.
3
IntermediateHow retentive timers accumulate time
🤔Before reading on: do you think the retentive timer resets automatically after reaching the preset time or does it keep counting? Commit to your answer.
Concept: Understand that retentive timers keep adding elapsed time until manually reset.
When the input to an RTO is ON, it counts up from the stored elapsed time. When the input turns OFF, it stops counting but keeps the elapsed time. The timer output becomes true once the accumulated time reaches the preset value. The timer does not reset automatically after timing out; it must be reset explicitly.
Result
The timer output stays true after reaching the preset until reset, and elapsed time is preserved across input changes.
Recognizing that retentive timers require manual reset prevents unexpected behavior in automation sequences.
4
IntermediateResetting retentive timers properly
🤔Before reading on: do you think turning the input OFF resets the retentive timer automatically? Commit to your answer.
Concept: Learn how to clear the stored elapsed time to reuse the timer.
Retentive timers do not reset when their input turns OFF. To reset the timer, a separate reset instruction or condition must be used. This clears the accumulated time back to zero, allowing the timer to start fresh on the next input ON.
Result
The timer elapsed time resets only when the reset command is executed, not when input changes.
Understanding the reset mechanism is crucial to avoid timers stuck in a timed-out state.
5
IntermediateUsing retentive timers in real processes
🤔
Concept: Apply RTOs to practical automation scenarios with pauses.
Imagine a conveyor belt that must run for 10 minutes total but can stop for breaks. Using an RTO, the timer counts only when the belt runs. If the belt stops, the timer pauses but remembers elapsed time. When the belt restarts, the timer continues counting from where it left off until 10 minutes total is reached.
Result
The process completes timing accurately despite interruptions.
Seeing RTOs in action clarifies their value in real-world automation where processes are not always continuous.
6
AdvancedCommon pitfalls with retentive timers
🤔Before reading on: do you think forgetting to reset an RTO can cause process errors? Commit to your answer.
Concept: Identify typical mistakes that cause unexpected timer behavior.
If an RTO is not reset after timing out, it will remain in the timed-out state, causing outputs to stay active indefinitely. Also, confusing RTOs with standard timers leads to logic errors. Proper reset logic and clear documentation prevent these issues.
Result
Avoiding these pitfalls ensures reliable and predictable automation.
Knowing common errors helps you design safer and more maintainable PLC programs.
7
ExpertInternal memory and scan cycle interaction
🤔Before reading on: do you think the RTO's elapsed time updates continuously or only once per scan cycle? Commit to your answer.
Concept: Explore how RTOs store elapsed time and update it during PLC scan cycles.
PLCs execute programs in scan cycles, reading inputs, executing logic, and updating outputs. The RTO updates its accumulated time only once per scan cycle when its input is ON. It stores elapsed time in a dedicated memory register that persists across cycles and power cycles if battery-backed. This design balances timing accuracy with PLC performance.
Result
Elapsed time increments in discrete steps per scan, not continuously, affecting timing precision.
Understanding scan cycle timing helps optimize timer use and troubleshoot subtle timing issues.
Under the Hood
Retentive timers work by storing elapsed time in a special memory register within the PLC. When the timer input is ON, the PLC adds the scan cycle time to this register each cycle. When the input is OFF, the register holds its value without resetting. The timer output bit is set when the stored elapsed time reaches or exceeds the preset value. Resetting the timer clears this register. This memory persistence allows the timer to retain its count across input changes and even power cycles if supported.
Why designed this way?
Retentive timers were designed to handle real-world processes that pause and resume, such as batch operations or maintenance breaks. Early PLCs had limited memory and processing power, so timers update only once per scan cycle to reduce overhead. The manual reset approach gives programmers control to avoid unintended resets, ensuring process safety and flexibility.
┌───────────────┐     ┌───────────────┐     ┌───────────────┐
│ Input Signal  │────▶│ Elapsed Time  │────▶│ Compare to    │
│ (ON/OFF)      │     │ Register      │     │ Preset Value  │
└───────────────┘     └───────────────┘     └───────────────┘
        │                     │                     │
        │                     │                     ▼
        │                     │             ┌───────────────┐
        │                     │             │ Timer Output  │
        │                     │             │ (True/False)  │
        │                     │             └───────────────┘
        │                     │
        │                     ▼
        │             ┌───────────────┐
        │             │ Reset Command │
        │             └───────────────┘
Myth Busters - 4 Common Misconceptions
Quick: Does turning the input OFF reset the retentive timer automatically? Commit to yes or no.
Common Belief:Turning the input OFF resets the retentive timer just like a standard timer.
Tap to reveal reality
Reality:Retentive timers do NOT reset when the input turns OFF; they keep the elapsed time until explicitly reset.
Why it matters:Assuming automatic reset leads to timers stuck in timed-out states, causing process failures or unexpected outputs.
Quick: Does the retentive timer output turn OFF automatically after timing out? Commit to yes or no.
Common Belief:The timer output automatically turns OFF after the preset time is reached and the input turns OFF.
Tap to reveal reality
Reality:The timer output remains ON after timing out until the timer is reset manually.
Why it matters:Misunderstanding this causes logic errors where outputs never deactivate, risking equipment damage or safety hazards.
Quick: Does the retentive timer count time continuously even when the PLC is powered off? Commit to yes or no.
Common Belief:Retentive timers keep counting time even if the PLC loses power.
Tap to reveal reality
Reality:Retentive timers retain elapsed time only if the PLC has battery-backed memory; otherwise, elapsed time resets on power loss.
Why it matters:Expecting timers to survive power loss without battery backup leads to incorrect timing and process restarts.
Quick: Can you use a retentive timer exactly like a standard timer without reset logic? Commit to yes or no.
Common Belief:Retentive timers can replace standard timers without adding reset instructions.
Tap to reveal reality
Reality:Retentive timers require explicit reset logic; otherwise, they behave differently and may cause stuck outputs.
Why it matters:Ignoring reset needs causes subtle bugs that are hard to diagnose in complex PLC programs.
Expert Zone
1
Retentive timers update elapsed time only once per PLC scan cycle, so timing precision depends on scan speed.
2
Elapsed time storage in retentive timers can be preserved across power cycles if the PLC supports battery-backed memory, but this is not guaranteed.
3
Stacking multiple retentive timers without proper reset logic can cause cumulative timing errors and complex debugging challenges.
When NOT to use
Avoid retentive timers when timing must reset automatically on input OFF or when precise continuous timing is required. Use standard TON timers for simple on-delay timing or hardware timers for high-precision needs.
Production Patterns
In production, retentive timers are used for batch processing, maintenance timers, and cumulative run-time tracking. They are combined with explicit reset instructions triggered by process completion or operator commands to ensure correct timing cycles.
Connections
State Machines
Retentive timers help implement state machines by preserving timing across state changes.
Understanding retentive timers clarifies how to maintain timing information when a system moves between states without losing progress.
Stopwatch
Retentive timers function like a stopwatch that can pause and resume timing.
Knowing how stopwatches work in everyday life helps grasp the concept of accumulating elapsed time over interruptions.
Human Memory Retention
Retentive timers mimic how humans remember elapsed time during breaks or pauses.
This connection shows how automation concepts often parallel natural cognitive processes, aiding intuitive understanding.
Common Pitfalls
#1Forgetting to reset the retentive timer after it reaches the preset time.
Wrong approach:RTO_Timer(IN=StartSignal, PT=10000); // No reset logic included
Correct approach:RTO_Timer(IN=StartSignal, PT=10000, RESET=ResetSignal); // Reset signal clears elapsed time
Root cause:Misunderstanding that retentive timers do not reset automatically and require explicit reset commands.
#2Assuming the timer resets when input turns OFF.
Wrong approach:If(StartSignal == FALSE) { // Expect timer to reset automatically // No reset code }
Correct approach:If(StartSignal == FALSE) { ResetSignal = TRUE; // Explicitly reset the timer }
Root cause:Confusing retentive timers with standard timers that reset on input OFF.
#3Using retentive timers for very short timing intervals requiring high precision.
Wrong approach:Using RTO for millisecond timing in a slow scan PLC program.
Correct approach:Use hardware timers or high-speed counters for precise short intervals instead of RTO.
Root cause:Not considering scan cycle timing granularity and timer update frequency.
Key Takeaways
Retentive timers remember elapsed time across input OFF periods, unlike standard timers that reset immediately.
They require explicit reset commands to clear accumulated time and avoid stuck outputs.
Elapsed time updates once per PLC scan cycle, so timing precision depends on scan speed.
Retentive timers are essential for processes that pause and resume, ensuring accurate total timing.
Misusing retentive timers without reset logic or for high-precision timing leads to common automation errors.

Practice

(1/5)
1. What is the main feature of a Retentive Timer (RTO) in PLC programming?
easy
A. It counts down from a preset time to zero.
B. It resets automatically when the timer input turns off.
C. It remembers elapsed time even if the timer is paused or stopped.
D. It only works for on-delay timing.

Solution

  1. Step 1: Understand Retentive Timer behavior

    Retentive timers keep track of elapsed time even when the timer is not running.
  2. Step 2: Compare options with this behavior

    Only It remembers elapsed time even if the timer is paused or stopped. describes this feature correctly; others describe non-retentive timers or different timer types.
  3. Final Answer:

    It remembers elapsed time even if the timer is paused or stopped. -> Option C
  4. Quick Check:

    Retentive timer remembers time = A [OK]
Hint: Retentive timers keep time even when paused [OK]
Common Mistakes:
  • Thinking RTO resets automatically
  • Confusing RTO with countdown timers
  • Assuming RTO only works when running
2. Which of the following is the correct syntax to reset a Retentive Timer (RTO) in a typical PLC program?
easy
A. RTO.ACC = 0
B. RTO.Reset()
C. RTO.EN = FALSE
D. RTO.TimerReset = TRUE

Solution

  1. Step 1: Identify how to reset RTO timers

    Retentive timers are reset by setting their accumulated time (ACC) to zero manually.
  2. Step 2: Match syntax options

    Only RTO.ACC = 0 correctly shows resetting ACC to zero; others are invalid or incorrect syntax.
  3. Final Answer:

    RTO.ACC = 0 -> Option A
  4. Quick Check:

    Reset RTO by ACC = 0 [OK]
Hint: Reset RTO by setting ACC to zero manually [OK]
Common Mistakes:
  • Trying to reset with a method call
  • Setting enable (EN) to false to reset
  • Using non-existent properties like TimerReset
3. Given the following PLC code snippet using an RTO timer:
IF Start THEN
  RTO.EN := TRUE;
ELSE
  RTO.EN := FALSE;
END_IF;

// After 5 seconds running, Start goes FALSE for 3 seconds, then TRUE again

// What will be the accumulated time (RTO.ACC) after 10 seconds total?
medium
A. 5 seconds
B. 7 seconds
C. 10 seconds
D. 3 seconds

Solution

  1. Step 1: Analyze timer enable periods

    The timer runs for 5 seconds (Start TRUE), then pauses for 3 seconds (Start FALSE), then runs again for 2 seconds (to reach 10 seconds total).
  2. Step 2: Calculate accumulated time

    Since RTO is retentive, it keeps the 5 seconds from first run, then adds 2 seconds after restart, totaling 7 seconds.
  3. Final Answer:

    7 seconds -> Option B
  4. Quick Check:

    Elapsed + resumed time = 7 seconds [OK]
Hint: Add only running time intervals for RTO ACC [OK]
Common Mistakes:
  • Assuming timer resets when stopped
  • Counting total elapsed time instead of run time
  • Ignoring retentive behavior
4. You have this RTO timer code snippet:
IF Start THEN
  RTO.EN := TRUE;
ELSE
  RTO.EN := FALSE;
  RTO.ACC := 0;
END_IF;

What is wrong with this code regarding RTO behavior?
medium
A. RTO.EN cannot be assigned directly; it causes syntax error.
B. EN should be set to FALSE only after ACC is reset.
C. The timer will never start because ACC is reset too late.
D. Resetting ACC inside ELSE resets timer every time Start is FALSE, losing retentive behavior.

Solution

  1. Step 1: Understand retentive timer reset rules

    Retentive timers keep accumulated time until manually reset; resetting ACC on every ELSE disables retention.
  2. Step 2: Analyze code effect

    Resetting ACC whenever Start is FALSE clears accumulated time, so timer never retains elapsed time.
  3. Final Answer:

    Resetting ACC inside ELSE resets timer every time Start is FALSE, losing retentive behavior. -> Option D
  4. Quick Check:

    Reset ACC only when needed to keep retention [OK]
Hint: Don't reset ACC on every disable to keep retention [OK]
Common Mistakes:
  • Resetting ACC too often
  • Confusing EN and ACC roles
  • Assuming EN assignment causes errors
5. You want to track total machine run time over multiple start/stop cycles using an RTO timer. Which approach correctly implements this behavior?
hard
A. Enable RTO when machine runs, disable when stopped, reset ACC only during maintenance.
B. Enable RTO only once at program start, never disable or reset ACC.
C. Reset ACC every time machine stops to start fresh timing.
D. Use a non-retentive timer and add its time to a separate counter.

Solution

  1. Step 1: Understand total run time tracking

    To track total run time, timer must accumulate elapsed time across multiple runs without resetting.
  2. Step 2: Evaluate options for correct retention

    Enable RTO when machine runs, disable when stopped, reset ACC only during maintenance. enables timer only when running and resets ACC only manually (e.g., maintenance), preserving total time.
  3. Step 3: Why others are incorrect

    Enable RTO only once at program start, never disable or reset ACC. never disables timer, which is impractical; C resets ACC losing total time; D uses wrong timer type.
  4. Final Answer:

    Enable RTO when machine runs, disable when stopped, reset ACC only during maintenance. -> Option A
  5. Quick Check:

    Manual ACC reset preserves total run time [OK]
Hint: Reset ACC only when you want to clear total time [OK]
Common Mistakes:
  • Resetting ACC on every stop
  • Leaving timer always enabled
  • Using non-retentive timers for total time
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard