Skip to main content

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

InstructionSymbolPurpose
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).

MemberTypeMeaning
.PREDINTPreset — target time in milliseconds
.ACCDINTAccumulated time in milliseconds
.ENBOOLEnable — 1 while the rung is true
.TTBOOLTiming — 1 while accumulating toward .PRE
.DNBOOLDone — 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.