EasyManua.ls Logo

Mitsubishi Electric MELSEC iQ-F Series - Page 55

Mitsubishi Electric MELSEC iQ-F Series
128 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...
6 ST LANGUAGE
6.1 Configuration
53
6
Function call statement
Assigning to variables stores the execution result of the function.
A user-defined function that does not return a value and a function that includes a VAR_OUTPUT variable in the argument of
a call statement can be executed as a statement by adding a semicolon (;) at the end.
RETURN statement
A user-defined function that does not return a value and a function that includes a VAR_OUTPUT variable in the parameter of
a call statement can be executed as a statement by adding a semicolon (;) at the end.
Conditional statement
Format Description
Function name(Variable1, Variable2, ...); Enclose an argument by "()" after the function name.
When using multiple arguments, delimit them by "," (comma).
Function Example
Calling a function with one input variable (Example: ABS)
Calling a function with three input variables (Example:
MAX)
Calling a function with EN/ENO (standard functions)
(Example: MAX_E)
Calling other than standard functions (Example: MOV)
(The execution result of the function is ENO and the first argument (Variable1) is EN.)
Syntax Format Description Example
RETURN RETURN; The RETURN statement is used to end a program, function
block, or function in the middle of processing.
When the RETURN statement is used in a program, the
processing jumps to the next step after the last line of the
program.
When the RETURN statement is used in a function block, the
processing is returned from the function block.
When the RETURN statement is used in a function, the
processing is returned from the function.
One pointer type label is used by the system for one RETURN
statement.
Syntax Format Description Example
IF IF <Boolean expression> THEN
<Statement⋅⋅> ;
END_IF;
The statement is executed when the value of Boolean
expression (conditional expression) is TRUE. The statement is
not executed if the value of Boolean expression is FALSE.
Any expression that returns TRUE or FALSE as the result of the
Boolean operation with a single bit type variable status, or a
complicated expression that includes many variables can be
used for the Boolean expression.
IF...ELSE IF <Boolean expression> THEN
<Statement 1⋅⋅⋅> ;
ELSE
<Statement 2⋅⋅⋅> ;
END_IF;
Statement 1 is executed when the value of Boolean expression
(conditional expression) is TRUE.
Statement 2 is executed when the value of Boolean expression
is FALSE.
IF...ELSIF IF <Boolean expression 1> THEN
<Statement 1⋅⋅⋅> ;
ELSIF <Boolean expression 2> THEN
<Statement 2⋅⋅⋅> ;
ELSIF <Boolean expression 3> THEN
<Statement 3⋅⋅⋅> ;
END_IF;
Statement 1 is executed when the value of Boolean expression
(conditional expression) 1 is TRUE. Statement 2 is executed
when the value of Boolean expression 1 is FALSE and the
value of Boolean expression 2 is TRUE.
Statement 3 is executed when the value of Boolean expression
1 and 2 are FALSE and the value of Boolean expression 3 is
TRUE.
Outout1 := ABS(Input1);
Outout1 := MAX(Input1, Input2, Input3);
Output1 := MAX_E(boolEN, boolENO, Input1, Input2, Input3);
boolENO := MOV(boolEN, Input1, Output1);
IF bool1 THEN
RETURN;
END_IF;
IF bool1 THEN
intV1:=intV1+1;
END_IF;
IF bool1 THEN
intV3:=intV3+1;
ELSE
intV4:=intv4+1;
END_IF;
IF bool1 THEN
intV1:=intV1+1;
ELSIF bool2 THEN
intv2:=intV2+2;
ELSIF bool3 THEN
intV3:=intV3+3;
END_IF;

Other manuals for Mitsubishi Electric MELSEC iQ-F Series

Related product manuals