Description - Omron CX-PROGRAMMER 5.0-FUNCTION BLOCK OPERATION Operation Manual

Function blocks
Table of Contents

Advertisement

Structured Text (ST Language) Specifications

Description

Condition 1 = If true, execute expression 1
Condition 1 = If false,
Condition 2 = If true, execute expression 2
Condition 2 = If false,
Condition 3 = If true, execute expression 3
etc.
Condition n = If true, execute expression n
If none of these conditions are met, condition m is executed.
Precautions
• IF must be used together with END_IF.
• Condition_@ contains the true or false result of the equation (e.g., IF(A>10)).
A boolean (BOOL data type) variable only can also be specified as the condition rather than an equation.
For boolean conditions, the result is true when the variable value is 1 (ON) and false when it is 0 (OFF).
• Statements that can be used in expression_@ are assignment statements, IF, CASE, FOR, WHILE, or
REPEAT.
• Multiple statements can be executed in expression_@. Be sure to use a semicolon (;) delimiter between
multiple statements in an expression.
• The ELSE statement can be omitted. When ELSE is omitted, no operation is executed if the result of any
condition equation is false.
Examples
Example 1: If variable A>0 is true, variable X will be substituted with numerical value 10.
If A>0 is false, but variable B=1, variable X will be substituted with numerical value 1.
If A>0 is false, but variable B=2, variable X will be substituted with numerical value 2.
If either of these conditions is met, variable X will be substituted with numerical value 0.
IF A>0 THEN X:=10;
ELSIF B=1 THEN X:=1;
ELSIF B=2 THEN X:=2;
ELSE X:=0;
END_IF;
CASE Statement
Summary
This statement executes an expression containing a selected integer that matches the value from an integer
equation. If the selected integer value is not the same, either no expression or a specified expression is exe-
cuted.
Reserved Word
CASE
Statement Syntax
CASE <integer_equation> OF
<integer_equation_value_1 >:<expression_1>;
<integer_equation_value_2>:<expression_2>;
<integer_equation_value_n>:<expression_n>;
ELSE <expression_m>;
END_CASE;
148
...
Appendix B

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the CX-PROGRAMMER 5.0-FUNCTION BLOCK OPERATION and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

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

Table of Contents

Save PDF