EasyManua.ls Logo

Mitsubishi Electric MELSEC iQ-F Series - Syntax

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
51
6
Syntax
The following table shows the types of statements that can be used in a ST program.
Write statements using half width characters.
Assignment statement
When an array type label or a structure label is used, check the data types of the left side and right side of the assignment
statement.
When an array type label is used, the data type and the number of elements need to be the same for the left side and right
side. Do not specify elements.
Ex.
intAry1 := intAry2;
When a structure label is used, the data type needs to be the same for the left side and right side.
Ex.
dutVar1 := dutVar2;
Automatic conversion of data types
In the ST language, if a different data type is assigned or a different arithmetic operation is described, the data type may be
automatically converted.
Ex.
Example of automatic conversion
Type conversion is performed in an assignment statement, input argument pass to a function block and function (VAR_INPUT
part), and an arithmetic operation.
Item Description Reference
Assignment statement Assignment statement Page 51 Assignment statement
Sub-program control statement Function block call statement, function call statement Page 52 Sub-program control statement
RETURN statement
Conditional statement IF statement (IF, IF...ELSE, IF...ELSIF) Page 53 Conditional statement
CASE statement
Iteration statement FOR statement Page 54 Iteration statement
WHILE statement
REPEAT statement
EXIT statement
Format Description Example
<Left side> := <Right side> ; The assignment statement assigns the result of the right side expression to the label or device of
the left side.
The result of the right side expression and the data type of the left side need to be the same data
type.
intV1 := 0;
intV2 := 2;
dintLabel1 := intLabel1;
// Assignment statement : Automatically convert the INT type variable (intLabel1) to a DINT type variable,
and assign it the DINT type variable (dintLabel1).
dintLabel1 := dintLabel2 + intLabel1;
// Arithmetic operation expression : Automatically convert the INT type variable (intLabel1) to a DINT type
variable, and perform DINT type addition.

Other manuals for Mitsubishi Electric MELSEC iQ-F Series

Related product manuals