EasyManua.ls Logo

Omron CX-PROGRAMMER 5.0-FUNCTION BLOCK OPERATION - Control Statements

Omron CX-PROGRAMMER 5.0-FUNCTION BLOCK OPERATION
183 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
145
Structured Text (ST Language) Specifications Appendix B
Example 3: Substitute variable A with the constant 10.
A:=10;
Precautions
The data type of the equation, variable, or constant to be assigned must be the same as the data type of the
variable to be substituted. Otherwise, a syntax error will occur.
Control Statements
IF Statement (Single Condition)
Summary
This statement is used to execute an expression when a specified condition is met. If the condition is not met,
a different expression is executed.
Reserved Words
IF, THEN, (ELSE), END_IF
Note ELSE can be omitted.
Statement Syntax
IF <condition> THEN
<expression_1>;
ELSE
<expression_2>;
END_IF;
Process Flow Diagram
Usage
Use the IF statement to perform a different operation depending on whether a single condition (condition equa-
tion) is met.
Description
Condition = If true, execute expression_1
Condition = If false, execute expression_2
Precautions
IF must be used together with END_IF.
The condition must include a true or false equation for the evaluation result.
Example: IF(A>10)
The condition can also be specified as a boolean variable only rather than an equation. As a result, the
variable value is 1 (ON) = True result, 0 (OFF) = False result.
Statements that can be used in expression_1 and expression_2 are assignment statements, IF, CASE,
FOR, WHILE, or REPEAT.
Condition
False
Tr ue
Expression 1 Expression 2

Table of Contents

Related product manuals