Skip to main content

Timers

TON

The TON (On-Delay Timer) function block is used to delay the turning on of an output. When the input signal (IN) is set to TRUE, the timer starts counting. Once the preset time (PT) has elapsed, the output (Q) is set to TRUE.

VAR
timer : TON;
in : BOOL := TRUE;
pt : TIME := T#100ms;
et : TIME;
q : BOOL;
END_VAR;

timer(IN := in,
PT := pt,
ET => et,
Q => q);

print(q);

TOF

The TOF (Off-Delay Timer) function block is used to delay the turning off of an output. When the input signal (IN) is set to FALSE, the timer starts counting. Once the preset time (PT) has elapsed, the output (Q) is set to FALSE.

VAR
tofTimer : TOF;
inputSignal : BOOL := TRUE;
elapsedTime : TIME := T#5s;
END_VAR

tofTimer(IN := inputSignal, PT := elapsedTime);

TP

The TP (Pulse Timer) function block is used to generate a pulse of a specified duration. When the input signal (IN) is set to TRUE, the output (Q) is set to TRUE for the duration of the preset time (PT), and then it is set to FALSE.

VAR
tpTimer : TP;
inputSignal : BOOL := FALSE;
pulseDuration : TIME := T#5s;
END_VAR

tpTimer(IN := inputSignal, PT := pulseDuration);