Chapter 8 Logic Instructions
8_
The input and output variables are allowed to be of different data types in this instruction. When the
data types of input and output variables are different, the range of the data type of the output
variable must include the valid ranges of data types of all input variables. Otherwise, there will be an
error during the compiling of the software. For example, if the data types of
In1
and
In2
are INT and
DINT respectively, the data type of
Out
is DINT. There will be an error during the compiling of the
software if the data type of
Out
is INT. No error will occur during the compiling of the software if the
data type of
Out
is LINT.
Precautions for Correct Use
The input variables are not allowed to omit. An error will occur during the compiling of the software if
any input variable is omitted. But the output variable is allowed to omit.
The input value of
In2
can not be 0. In other words, the divisor in the division operation can not be 0.
The value of
Out
will be 0 if the value of
In2
is 0.
The division result of
In1
and
In2
may be out of the valid range of the data type of
Out.
For example, the data types of “DIV _In1” and “DIV _In2” are both INT with their respective values,
-32768 and -1. If the data type of the output variable is INT, the output variable value will be -32768
as shown in the following table, variable 1. If the data type of the output variable is set to DINT, the
output variable value will be 32768 as shown in the following table, variable 2.
Variable 1
Variable name
Data type
Current value
DIV_EN
BOOL
TRUE
DIV_In1
INT
-32768
DIV_In2
INT
-1
Out1
INT
-32768
Variable 2
Variable name
Data type
Current value
DIV_EN
BOOL
TRUE
DIV_In1
INT
-32768
DIV_In2
INT
-1
Out1
DINT
32768
The Program
1
DIV
EN
ENO
I n1
O ut
I n2
DIV _EN
DIV _In1
DIV _In2
Out 1
The result is always an integer for the division of two integers. Even if there is a remainder for the
division of two integers, the remainder is cut.
For example, the data types of
In1
and
In2
are both INT with their respective values, 10 and 3. And
the data type of
Out
is INT and Real and thus its value is 3 and 3.0 respectively as illustrated in the
following figure.
I n1
In2
/
=
Divis ion res ult
Ou t1
I NT
3
INT
10
3
3
Out 2
3 .0
RE AL
INT
I NT
8-63
Summary of Contents for DVP15MC11T
Page 9: ...Memo viii...
Page 15: ...DVP15MC11T Operation Manual _2 MEMO 2 4...
Page 71: ...DVP15MC11T Operation Manual _7 Memo 7 10...
Page 81: ...DVP15MC11T Operation Manual _8 Timing Chart F_TRG_CLK F_TRG_Q 8 10...
Page 158: ...Chapter 8 Logic Instructions 8_ The program 1 ASIN EN ENO In Out ASIN_EN ASIN_In Out1 8 87...
Page 249: ...DVP15MC11T Operation Manual _8 8 178...
Page 285: ...DVP15MC11T Operation Manual _8 Memo 8 214...
Page 323: ...DVP15MC11T Operation Manual 10 MEMO 10 34...
Page 549: ...DVP15MC11T Operation Manual A MEMO A 16...