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

Function blocks
Table of Contents

Advertisement

Structured Text (ST Language) Specifications
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.
IF, THEN, (ELSE), END_IF
Note ELSE can be omitted.
<expression_1>;
<expression_2>;
Expression 2
Use the IF statement to perform a different operation depending on whether a single condition (condition equa-
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.
Appendix B
145

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