Omron CX-PROGRAMMER 5.0-FUNCTION BLOCK OPERATION Operation Manual page 168

Function blocks
Table of Contents

Advertisement

Structured Text (ST Language) Specifications
Precautions
• WHILE must be used in combination with END_WHILE.
• Before executing the expression, if the condition equation is false, the process will end without executing
the expression.
• Statements that can be used in the expression are assignment statements, IF, CASE, FOR, WHILE, or
REPEAT.
• Multiple statements can be executed in the expression. Be sure to use a semicolon (;) delimiter between
multiple statements in an expression.
• The condition can also be specified as a boolean variable (BOOL data type) only rather than an equation.
Examples
Example 1: The value exceeding 1000 in increments of 7 is calculated and substituted for variable A.
A:=0;
WHILE A>=1000 DO
A:=A+7;
END_WHILE;
Example 2: While X<3000, the value of X is doubled, and the value is substituted for the array variable DATA[1].
The value of X is then multiplied by 2 again, and the value is substituted for the array variable DATA[2]. This
process is repeated.
n:=1'
WHILE X<3000 DO
X:=X*2;
DATA[n]:=X;
n:=n+1;
END_WHIE;
REPEAT Statement
Summary
This statement is used to repeatedly execute an expression until a specified condition is true.
Reserved Words
REPEAT, UNTIL, END_REPEAT
Statement Syntax
REPEAT
<expression>;
UNTIL <condition>
END_REPEAT
Processing Flow Chart
Expression
Condition
True
End
Iteration
False
Appendix B
153

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cx-programmer 5.0Sysmac ws02-cxpc1-e-v50Cs1-hCj1-hCj1m

Table of Contents