# TON — On-Delay Timer

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

> TON in rungs.dev is the on-delay timer — starts timing when the rung goes true, sets the .DN bit when .ACC reaches .PRE, and resets when the rung goes false.

On-delay timer. Starts timing when the rung goes true; sets `.DN` when `.ACC` reaches `.PRE`. Resets the moment the rung goes false.

## 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`   | reset to `0`               | `0`   |

Going false at any point resets the timer. `TON` is **not** retentive — use [`RTO`](https://rungs.dev/docs/ladder-logic/instructions/rto) if you need the accumulator to survive interruptions. 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 — Delayed Alarm [#example--delayed-alarm]

Turn on an alarm five seconds after a fault appears.

```ladder
XIC(Fault)TON(FaultTimer);XIC(FaultTimer.DN)OTE(Alarm)

FaultTimer.PRE = 5000
FaultTimer.ACC = 0
```

- Rung 1 runs the timer while `Fault` is active.
- Rung 2 energizes `Alarm` once `FaultTimer.DN` is set.

> **IDEA**
>
> **Practice**
>
> Try `TON` in the [On Delay exercise](https://rungs.dev/exercises/on-delay) — switch an output on a set time after its input.

## Common Mistakes [#common-mistakes]

- Referencing `FaultTimer` instead of `FaultTimer.DN` on a contact — the whole structure is not a `BOOL`.
- Expecting the accumulator to survive a dropped rung — `TON` resets to zero. Use [`RTO`](https://rungs.dev/docs/ladder-logic/instructions/rto) for retentive timing.
- Writing `0` to `.ACC` to restart a finished timer — `.DN` stays `1` while the rung remains true. Let the rung go false or use [`RES`](https://rungs.dev/docs/ladder-logic/instructions/res) to clear and re-arm the timer.

## Related [#related]

- [Timers overview](https://rungs.dev/docs/ladder-logic/instructions/timers) — members, units, and shared behaviour
- [TOF](https://rungs.dev/docs/ladder-logic/instructions/tof) — off-delay counterpart
- [RTO](https://rungs.dev/docs/ladder-logic/instructions/rto) — retentive timer