# TOF — Off-Delay Timer

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

> TOF in rungs.dev is the off-delay timer — starts timing when the rung goes false and holds the .DN bit at 1 for the preset duration after the rung drops.

Off-delay timer. Starts timing when the rung goes false; holds `.DN` at `1` for the preset duration after the rung drops.

## 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                      | `1`   | `0`   | `0`                        | `1`   |
| False, `.ACC` &lt; `.PRE` | `0`   | `1`   | counting up                | `1`   |
| False, `.ACC` ≥ `.PRE`    | `0`   | `0`   | stops at its current value | `0`   |

While the rung is true, the timer is "primed" — `.DN` is `1` with zero elapsed time. When the rung drops, `.DN` stays `1` and the accumulator counts up. The first execution where `.ACC` is at least `.PRE` turns `.DN` off. `.ACC` can pass `.PRE` before stopping; it is not forced back to `.PRE`.

## Example — Exhaust Fan Run-On [#example--exhaust-fan-run-on]

Keep an exhaust fan running for 30 seconds after the machine stops.

```ladder
XIC(MachineRunning)TOF(ExhaustTimer);XIC(ExhaustTimer.DN)OTE(ExhaustFan)

ExhaustTimer.PRE = 30000
ExhaustTimer.ACC = 0
```

`ExhaustFan` stays on while the machine is running **and** for 30 seconds after it stops.

> **IDEA**
>
> **Practice**
>
> Try `TOF` in the [Off Delay exercise](https://rungs.dev/exercises/off-delay) — keep an output on for a set time after its input drops.

## Common Mistakes [#common-mistakes]

- Expecting `TOF` to start timing when the rung goes true — it is the opposite. `TON` times on rising edge, `TOF` on falling edge.

## 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) — on-delay counterpart
- [RTO](https://rungs.dev/docs/ladder-logic/instructions/rto) — retentive timer