Bird
Raised Fist0
PLC Programmingscripting~10 mins

Retentive timer (RTO) behavior in PLC Programming - Step-by-Step Execution

Choose your learning style10 modes available
Concept Flow - Retentive timer (RTO) behavior
Start RTO
↓
Timer Enabled?
↓
Count Time
↓
Time >= Preset?
↓
Timer Done
↓
Stop or Reset?
↓
Reset Time
↓
End
The retentive timer counts time when enabled, holds its count when disabled, and resets only when explicitly reset.
Execution Sample
PLC Programming
RTO_Timer.EN = TRUE
RTO_Timer.PRE = 5
// Time increments while EN is TRUE
// Time holds when EN is FALSE
// Reset clears accumulated time
This code shows a retentive timer that counts up to 5 seconds only when enabled, retains time when disabled, and resets on command.
Execution Table
StepEN (Enable)Accumulated Time (ACC)Condition (ACC >= PRE)ActionOutput (Timer Done)
1TRUE00 >= 5? FALSEStart countingFALSE
2TRUE11 >= 5? FALSECountingFALSE
3FALSE22 >= 5? FALSEHold time (no increment)FALSE
4FALSE22 >= 5? FALSEHold timeFALSE
5TRUE22 >= 5? FALSEResume countingFALSE
6TRUE33 >= 5? FALSECountingFALSE
7TRUE44 >= 5? FALSECountingFALSE
8TRUE55 >= 5? TRUETimer doneTRUE
9FALSE55 >= 5? TRUEHold timeTRUE
10FALSE00 >= 5? FALSEReset timerFALSE
💡 Timer stops counting when EN is FALSE and resets only when reset command is given.
Variable Tracker
VariableStartAfter 1After 2After 3After 4After 5After 6After 7After 8After 9After 10
ENFALSETRUETRUEFALSEFALSETRUETRUETRUETRUEFALSEFALSE
ACC00122234550
Timer DoneFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSETRUETRUEFALSE
Key Moments - 3 Insights
Why does the accumulated time (ACC) not reset when EN becomes FALSE?
Because the retentive timer holds the accumulated time when EN is FALSE instead of resetting it, as shown in steps 3 and 4 where ACC stays at 2.
When does the timer output (Timer Done) become TRUE?
The timer output becomes TRUE only when the accumulated time reaches or exceeds the preset value, as seen at step 8 when ACC is 5 and PRE is 5.
What causes the accumulated time to reset to zero?
The accumulated time resets only when a reset command is given, demonstrated at step 10 where ACC goes from 5 to 0.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the accumulated time (ACC) at step 5 when EN becomes TRUE again?
A3
B2
C0
D5
💡 Hint
Check the ACC column at step 5 in the execution_table; it holds the value from before EN was FALSE.
At which step does the timer output (Timer Done) first become TRUE?
AStep 8
BStep 9
CStep 6
DStep 10
💡 Hint
Look at the Timer Done column in the execution_table to find when it changes to TRUE.
If the reset command was not given at step 10, what would be the ACC value at step 10?
A1
B0
C5
DUndefined
💡 Hint
Refer to the variable_tracker and execution_table rows for step 10 to see the effect of reset on ACC.
Concept Snapshot
Retentive Timer (RTO) Behavior:
- Counts time only when enabled (EN = TRUE).
- Holds accumulated time when disabled (EN = FALSE).
- Timer output is TRUE when ACC >= PRE.
- ACC resets only on explicit reset command.
- Useful for timing across interruptions without losing progress.
Full Transcript
A retentive timer (RTO) in PLC programming counts time only when enabled. When the enable input (EN) is TRUE, the timer accumulates time towards a preset value (PRE). If EN becomes FALSE, the timer holds the accumulated time without resetting it. The timer output becomes TRUE when the accumulated time (ACC) reaches or exceeds the preset. The accumulated time resets only when a reset command is given. This behavior allows timing to pause and resume without losing progress, useful in many automation scenarios.

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