Omron NJ-series User Manual page 287

Machine automation controller cpu unit software
Hide thumbs Also See for NJ-series:
Table of Contents

Advertisement

6 Programming
 EXIT
Overview:
Use this statement only inside a repeat construct (FOR construct, WHILE construct, or REPEAT
construct) to exit the repeat construct.
Use this statement inside an IF construct to exit from the repeat construct when a condition is met.
Reserved Words:
EXIT
Construct Structure (e.g., in an IF Construct):
FOR (WHILE, REPEAT) <statement>
·
·
·
IF <condition_expression> THEN EXIT;
END_IF;
·
·
·
END_FOR (WHILE, REPEAT);
Application:
Use EXIT to end a repeating process before the end condition is met.
Description (e.g., in an IF Construct):
If the <condition_expression> is TRUE, the repeat construct (FOR construct, WHILE construct, or
REPEAT construct) is ended and all code inside the repeat construct after the EXIT statement is
ignored.
Note 1 You can also specify a BOOL variable instead of an expression for the condition expressions.
2 Even if the <condition_expression> is TRUE before <statement> is executed, <statement> is executed.
Example:
Variable n is repeatedly incremented by 1 from 1 to 50 while the value of n is added to array vari-
able elements DATA[n]. However, if DATA[n] exceeds 100, the repeat construct is exited.
IF A THEN
DATA[3] :=98;
FOR n := 1; TO 50 BY 1 DO
END_FOR;
A :=FALSE;
END_IF;
 Function Block Calls
Overview:
This statement calls a function block.
6-100
DATA[n] := DATA[n] + n;
IF DATA[n] > 100 THEN EXIT;
END_IF;
NJ-series CPU Unit Software User's Manual (W501)

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents