Retentive Timer On (RTO)
The RTO instruction is a retentive timer that accumulates time when the instruction is enabled.
The RTO instruction accumulates time until:
- The timer is disabled.
- The timer completes.
The time base is always 1 millisecond. For example, for a 2 second timer, enter 2000 for the .PRE value.
The timer will set the .DN bit to true when the timer completes.
When enabled, timing can be paused by setting the .DN bit to true and resumed by clearing the .DN bit to false.
Available Languages
Ladder Diagram
Operands
IMPORTANT:
Unexpected operation may occur if:
- Output tag operands are overwritten.
- Members of a structure operand are overwritten.
- Except when specified, structure operands are shared by multiple instructions.
Ladder Diagram
Operand | Data Type | Format | Description |
---|---|---|---|
Timer | TIMER | tag | Timer structure |
Preset | DINT | immediate | Value of Timer.PRE. |
Accum | DINT | immediate | Value of Timer.ACC. |
TIMER Structure
Mnemonic | Data Type | Description |
---|---|---|
.EN | BOOL | The enable bit contains rung-condition-in when the instruction was last executed. |
.TT | BOOL | The timing bit when set indicates the timing operation is in process. |
.DN | BOOL | The done bit when set indicates the timing operation is complete (or paused). |
.PRE | DINT | The preset value specifies the value (1 millisecond units) which the accumulated value must reach before the instruction indicates it is done. |
.ACC | DINT | The accumulated value specifies the number of milliseconds that have elapsed since the RTO instruction was enabled. |
How a Timer Runs
A timer runs by subtracting the time of its last scan from the current time:
ACC = ACC + (current_time - last_time_scanned)
After it updates the ACC, the timer sets last_time_scanned = current_time. This gets the timer ready for the next scan.
Affects Math Status Flags
No
Major/Minor Faults
A major fault will occur if: | Fault type | Fault code |
---|---|---|
.PRE < 0 | 4 | 34 |
.ACC < 0 | 4 | 34 |
See Index through arrays for array-indexing faults.
Execution
Ladder Diagram
Condition/State | Action Taken |
---|---|
Prescan | The .EN bit is cleared to false. The .TT bit is cleared to false. |
Rung-condition-in is false | Set Rung-condition-out to Rung-condition-in The .EN bit is cleared to false. The .TT bit is cleared to false. |
Rung-condition-in is true | Set Rung-condition-out to Rung-condition-in See RTO Flow Chart (True). |
Postscan | N/A |
RTO Flow Chart (True)
Example
Ladder Diagram
When limit_switch_7 is set, light_2 is on for 180 milliseconds (timer_3 is timing). When timer_3.acc reaches 180, light_2 goes off and light_3 goes on. Light_3 remains until timer_3 is reset. If limit_switch_7 is cleared while timer_3 is timing, light_2 goes off. When limit_switch_7 is set, the RES instruction resets timer_3 (clears status bits and .ACC value).
Provide Feedback