Timers
Timers measure elapsed time. A timer instruction references a TIMER tag, which is a structure with a preset, an accumulator, and three status bits.
Available Timer Instructions
| Instruction | Symbol | Purpose |
|---|---|---|
| TON | TON Timer timer (EN) Preset ? (DN) Accum ? | On-delay timer. Starts timing when the rung goes true; sets .DN when .ACC reaches .PRE. Resets the moment the rung goes false. |
| TOF | TOF Timer timer (EN) Preset ? (DN) Accum ? | Off-delay timer. Starts timing when the rung goes false; holds .DN at 1 for the preset duration after the rung drops. |
| RTO | RTO Timer timer (EN) Preset ? (DN) Accum ? | Retentive on-delay timer. Like TON, but the accumulator survives rung transitions. Must be cleared explicitly with RES. |
TIMER Tag Members
Every TIMER tag exposes the same fields. Access them with a dot (MyTimer.DN).
| Member | Type | Meaning |
|---|---|---|
.PRE | DINT | Preset — target time in milliseconds |
.ACC | DINT | Accumulated time in milliseconds |
.EN | BOOL | Enable — 1 while the rung is true |
.TT | BOOL | Timing — 1 while accumulating toward .PRE |
.DN | BOOL | Done — each timer (TON, TOF, RTO) decides when this turns on |
Reference these members as contacts:
XIC(MyTimer.DN)OTE(Light)
Setting the Preset
The preset is stored on the timer tag, not inside the instruction. There are two ways to set it:
- From the rung: click the
Presetrow on theTON,TOF, orRTOblock and type the value. This edits the.PREdefault of the underlyingTIMERtag in place — no need to leave the ladder editor. - From the Tag editor: expand the timer tag's row and edit the
Default Valueof.PRE.
Either way, the value is the target time in milliseconds: 5000 = 5 seconds. The Accum row on the block is editable the same way and sets the .ACC default, which is mainly useful for tests that start mid-count.
Units
All timer values are in milliseconds. There is no separate time base — always multiply seconds by 1000.