$IF ONCE

When the condition is fulfilled the first time, the instruction section is executed once. The instruction section is no longer executed in later run-throughs, even if the condition is fulfilled.

Programming Example

$IF ONCE

; Define real-time cycle
#RT CYCLE [SCOPE = PROG]
  ; Query ACS position of X axis
  $IF ONCE V.RTA.ACS.ACT_POS.X > 200
    ; Output M function
    M100
  $ENDIF
#RT CYCLE END