151
4
4 Instructions 4.5.1 Data 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 BCD instruction requires contact driving and has two operands. It converts the BIN value in S to a BCD
number. The result is stored in D. The BCD instruction is generally used for data format processing before
data is displayed.
When the 16-bit instruction is used, the value range is 0 to 9999; when the 32-bit instruction is used, it is
0 to 99,999,999. An error will occur when the conversion result exceeds 9999 or 99,999,999. M8067 and
M8068 are set to ON to identify this error, and the error code is stored in D8067.
Example:
M8
ǒBCD D200 K1Y0Ǔ
The BIN value in D200 is converted to a BCD equivalent.
The digit in the ones place of the result is stored in K1Y0
(four bit components Y0 to Y3).
If D200 = H000E (hexadecimal) = K14 (decimal),
then Y0–Y3 = 0100 (BIN).
If D200 = H0028 (hexadecimal) = K40 (decimal),
then Y0–Y3 = 0000 (BIN).
BIN: Conversion from BCD to binary format
◆
Overview
The BIN instruction converts BCD numbers to binary equivalents.
BIN S D
Conversion from BCD
to binary format
Applicable model:
H3U
S
Data
source
BCD data, or address of the word element that stores the
data
16-bit instruction
(5 steps)
BIN: Continuous
execution
BINP: Pulse
execution
32-bit instruction
(9 steps)
DBIN:
Continuous
execution
DBINP: Pulse
execution
D
Conversion
result
Address of the word element that stores the binary
equivalent of a BCD number
◆
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.