The TON timer in Structured Text, in practice
How the on-delay timer works, why it is the standard cure for chattering alarms, and an example you can run in the ST Lab.
What is TON?
TON (timer on-delay) is an IEC 61131-3 function block. Its output Q turns TRUE only after input IN has stayed TRUE continuously for PT. If IN drops earlier, the elapsed time ET resets.
Variable | Type | Meaning |
|---|---|---|
IN | BOOL | start condition |
PT | TIME | preset time |
Q | BOOL | true once PT has elapsed |
ET | TIME | elapsed time |
Example: a high-level alarm that does not chatter
When a level hovers around its alarm limit, the alarm flickers on and off. ISA-18.2 recommends an on-delay:
HiTmr(IN := Level > 85.0, PT := T#2s);
HiAlm := HiTmr.Q;The alarm appears only if the level stays above 85% for two seconds.
Common mistakes
- Calling the timer only inside an IF: if it is not called every scan, it does not update. Call it every scan and change
IN. - Confusing it with TOF:
TOFdelays switching off, not on. - Reading Q before the call gives you the previous scan's value.
Run the full example in the ST Lab in the workshop.