EasyManua.ls Logo

Mitsubishi Electric MELSEC iQ-F Series - Page 57

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
55
6
Precautions
When an assignment statement is used
The maximum number of character strings that can be assigned is 255. If 256 or more character strings are assigned, a
conversion error occurs.
Contacts and coils of the timer type or counter type cannot be used for the left side of an assignment statement.
The instance of a function block cannot be used for the left side of an assignment statement. Use input variables, input/
output variables, and external variables of the instance for the left side of an assignment statement.
When the step relay (S) or SFC block device (BL) is used
If the step relay (S) or SFC block device (BL) is used at the right-hand of an assignment statement or as an input argument of
a function or function block, a conversion error may occur. If an error occurs, change the assignment statement.
Ex.
The following is the example of rewriting.
In addition, to use the digit-specified step relay (S) or the step relay with block specification (BL\S), the data size must be
specified correctly. Since the step relay (S) and the step relay with block specification (BL\S) are not targeted for
automatic conversion of data type, a conversion error may occur if the data size is not the same.
Ex.
The following is the example of rewriting.
When an assigned arithmetic operation is used
When an arithmetic operation result is assigned to a variable of the larger data type, convert the variable of the arithmetic
operation to the data type of the left side in advance and execute the operation.
Ex.
When an arithmetic operation result of 16-bit data (INT type) is assigned to 32-bit data (DINT type)
The arithmetic operation result is the same data type as that of the input operand. Thus, in the case of the above program,
when the operation result of varInt1 * 10 exceeds the range of the INT type (-32768 to +32767), an overflow or underflow
result is assigned to varDint1.
In this case, convert the operand of the operational expression to the data type of the left side in advance and execute the
operation.
Before change After change
Before change After change
M0 := S0;
IF
S0
THEN
M0 :=
TRUE
;
ELSE
M0 :=
FALSE
;
END_IF
;
(*Conversion error because K4S0 is 16 bits and D0:UD is 32 bits*)
D0:UD := K4S0;
(*Conversion error because BL1\K4S10 is 16 bits and the second
argument of DMOV is 32 bits*)
DMOV(TRUE,BL1\K4S10,D100);
(*Assign data to the 16-bit device.*)
D0 := K4S0;
(*Specify 32-bit data for DMOV.*)
DMOV(TRUE, BL1\K8S10, D100:UD);
varDint1 := varInt1 * 10; // VarInt1 is a INT type variable, and varDint1 is a DINT type variable.
varDint2 := INT_TO_DINT(varInt1); // INT type variable is converted to DINT type variable.
varDint2 := varDint2 * 10; // DINT type multiplication is performed, and the operation result is assigned.

Other manuals for Mitsubishi Electric MELSEC iQ-F Series

Related product manuals