ON

Statement - Conditional execution of statements.

Syntax

ON <BOOL expression> DO
<statements>
END_DO;

Remarks


  • This instruction is NOT UDFB safe.
    Do not use inside UDFBs.

  • The ON instruction:
    • Provides a simpler syntax for checking the rising edge of a Boolean condition.
    • Avoids systematic use of the R_TRIG function block or other "last state" flags.
  • Statements within the ON structure are executed only when the Boolean expression rises from FALSE to TRUE.
  • The ON syntax is available in any program or sub-program.
  • This statement is an extension to the standard and is NOT IEC 61131-3 compliant.

FBD Language Example

Not available.

FFLD Language Example

Not available.

IL Language Example

Not available.

ST Language Example

(* This example counts the rising edges of variable bIN *)
ON bIN DO
   diCount := diCount + 1;
END_DO;