6-78
6.3 Data Conversion Instructions
6.3.5 Floating-point data to 16-/32-bit BIN data conversion (single precision)
INT, DINT
DINT(P)
(1) Converts the floating-point real number specified for
to 32-bit BIN data, and stores the
result to the device specified for
.
(2) Floating-point real numbers between 2147483648 and 2147483647 can be specified for
.
(3) The integer value stored in
is stored as BIN 32 bits.
(4) After conversion, the first digit from the decimal point of real number is rounded off.
O
p
erat
i
on
E
rror
In any of the following cases, an operation error occurs, the error flag (SM0) is turned ON, and
the corresponding error code is stored to SD0.
• The value of the specified device is outside the following range. (For Universal model
QCPU only)
0, 2
-126
| value of the specified device | < 2
128
(Error code: 4140)
• The value of the specified device is
-
0, unnormalized number, nonnumeric or
±∞.
(For Universal model QCPU only)
(Error code: 4140)
• The 32-bit floating-point data specified for
is outside the range of 32768 to 32767 for
the INT instruction.
(Error code: 4100)
• The 32-bit floating-point data specified for
is outside the range of 2147483648 to
2147483647 for the DINT instruction.
(Error code: 4100)
Program
E
xam
pl
e
(1) In the following program, the floating-point real number in Var_D20 is converted to the 16-bit
BIN value, and the result is stored to Var_D0.
[Structured ladder]
s
d
B
IN
3
2 bi
ts
L
o
w
er
16 bi
ts
Upp
er
16 bi
ts
Fl
oat
i
ng
-p
o
i
nt
rea
l
num
b
er
s
d
s
d
s
s
Summary of Contents for MELSEC Q Series
Page 1: ...Structured Programming Manual Mitsubishi Programmable Controller QCPU Common Instructions ...
Page 2: ......
Page 14: ...A 12 MEMO ...
Page 340: ...6 178 MEMO MTR ...
Page 708: ...7 368 MEMO ...
Page 776: ...8 68 MEMO ...
Page 796: ...9 20 MEMO ...
Page 804: ...App 8 MEMO ...
Page 812: ...Index 8 MEMO ...
Page 815: ......