# RTO — Retentive Timer On

Source: https://rungs.dev/docs/ladder-logic/instructions/rto

> RTO in rungs.dev is the retentive on-delay timer — like TON, but the .ACC accumulator survives rung transitions and must be cleared explicitly with RES.

Retentive on-delay timer. Like `TON`, but the accumulator survives rung transitions. Must be cleared explicitly with `RES`.

## Operands [#operands]

| Name     | Type    |
| -------- | ------- |
| `timer`  | `TIMER` |
| `preset` | `DINT`  |
| `accum`  | `DINT`  |

`preset` and `accum` are pseudo-operands: they hold the value of `.PRE` and `.ACC` on the timer tag.

## How It Works [#how-it-works]

| Rung state               | `.EN` | `.TT` | `.ACC`                     | `.DN`    |
| ------------------------ | ----- | ----- | -------------------------- | -------- |
| True, `.ACC` &lt; `.PRE` | `1`   | `1`   | counting up                | `0`      |
| True, `.ACC` ≥ `.PRE`    | `1`   | `0`   | stops at its current value | `1`      |
| False                    | `0`   | `0`   | **retained**               | retained |

A [`RES`](https://rungs.dev/docs/ladder-logic/instructions/res) on the timer tag clears `.ACC`, `.EN`, `.TT`, and `.DN` back to `0`. The timer checks for completion only when the instruction runs. This means `.ACC` can pass `.PRE` before stopping; it is not forced back to `.PRE`.

## Example — Maintenance Hour Counter [#example--maintenance-hour-counter]

Accumulate run-time across many start/stop cycles. Alert the operator once the machine has run for eight hours total.

```ladder
XIC(MachineRunning)RTO(RunHours);XIC(RunHours.DN)OTE(MaintAlert);XIC(ResetMaint)RES(RunHours)

RunHours.PRE = 28800000
RunHours.ACC = 0
```

The timer keeps counting only while `MachineRunning` is true, but never resets on its own. Pressing `ResetMaint` clears it back to zero.

## When to Use [#when-to-use]

- Run-time accumulators, maintenance counters, total elapsed fault time.
- Any situation where timing must survive power cycles or intermittent triggers.

## Common Mistakes [#common-mistakes]

- Forgetting the [`RES`](https://rungs.dev/docs/ladder-logic/instructions/res) — the timer will stay `.DN = 1` forever after it finishes.
- Writing `0` to `.ACC` instead of using [`RES`](https://rungs.dev/docs/ladder-logic/instructions/res) — `.DN` remains `1`, so the timer does not restart while its rung stays true.
- Confusing `RTO` with `TON` — `TON` resets automatically; `RTO` does not.

## Related [#related]

- [Timers overview](https://rungs.dev/docs/ladder-logic/instructions/timers) — members, units, shared behaviour
- [TON](https://rungs.dev/docs/ladder-logic/instructions/ton) — non-retentive counterpart
- [RES](https://rungs.dev/docs/ladder-logic/instructions/res) — clears the accumulator
- [Counters overview](https://rungs.dev/docs/ladder-logic/instructions/counters) — retentive accumulators for counts instead of time