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
Open the tag editor for the timer's tag and set the Default Value of .PRE. The preset is stored on the tag, not inside the instruction. The value is the target time in milliseconds: 5000 = 5 seconds.
Units
All timer values are in milliseconds. There is no separate time base — always multiply seconds by 1000.