150
4
4 Instructions4.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
Binary oating-point numbers are rounded to remove the fractional part. The result is stored in D.
M8020 is set when S = 0.
The borrow ag M8021 is set when |S| ≤ 1.
The carry ag M8022 is set if the operation result exceeds either of the following ranges (which results in
an overow):
16-bit instruction: –32,768 to +32,767
32-bit instruction: –2,147,483,648 to +2,147,483,647
Example:
ǒINT D50 D100Ǔ
M10
D
ǒDINT D10 D20Ǔ
M11
S
The floating-point number in (D51, D50) is rounded.
The result is stored in (D100).
The floating-point number in (D11, D10) is rounded.
The result is stored in (D21, D20).
The results of the INT and DINT instructions are stored in
different locations.
BCD: Conversion from binary to BCD format
◆
Overview
The BCD instruction converts binary numbers to binary coded decimal (BCD) equivalents.
BCD S D
Conversion from
binary to BCD format
Applicable model:
H3U
S
Data
source
Binary data, or address of the word element that stores the binary
data
16-bit instruction
(5 steps)
BCD: Continuous
execution
BCDP: Pulse
execution
32-bit instruction
(9 steps)
DBCD: Continuous
execution
DBCDP: Pulse
execution
D
Conversion
result
Address of the word element that stores the BCD equivalent of a
binary number