152
4
4 Instructions4.5.1 Data Conversion
◆
Function
The BIN instruction requires contact driving and has two operands. It converts the BCD value in S to a
BIN number. The result is stored in D. The instruction is generally used to convert the data (for example,
encoder disk setting) read by external ports to BIN data that can be directly used in operation.
The BCD value in S must be in the range 0 to 9999 in 16-bit operation or 0 to 99,999,999 in 32-bit
operation.
When the data in S is not in BCD format (Hex indicates any digit beyond the range 0 to 9), an operation
error will occur, and M8067 and M8068 are set to identify this error.
Example:
M8
ǒBIN K1Y0 D200Ǔ
When M8 is set, the BCD value in K1Y0 is converted
to a BIN equivalent. The result is stored in D200.
FLT: Conversion from binary integer format to binary oating-point number
format
◆
Overview
The FLT instruction converts binary integers to binary oating-point numbers.
FLT S D
Conversion from binary
integer format to binary
oating-point number
format
Applicable model:
H3U
S Integer
Binary integer to be converted, or address of the word
element that stores the binary integer
16-bit instruction
(5 steps)
FLT: Continuous
execution
FLTP: Pulse
execution
32-bit instruction
(9 steps)
DFLT:
Continuous
execution
DFLTP: Pulse
execution
D
Floating-
point
number
Address of the word element that stores the oating-point
number after conversion
◆
Operands
Operand
Bit Element Word Element
System·User System·User Bit Designation Indexed Address Constant
Real
Number
S X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
D X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
Note: The elements in gray background are supported.
◆
Function
The integer in S is converted to a oating-point number. The result is stored in D and D+1.
The constants K and H are automatically converted in all oating point operation instructions and therefore
cannot be used in the FLT instruction.
The INT instruction is the inverse function of FLT.