Mitsubishi Electric MELSEC iQ-R Series Programming Manual page 468

Hide thumbs Also See for MELSEC iQ-R Series:
Table of Contents

Advertisement

Processing details
• These instructions convert the single-precision real number data stored in the device specified by (s1) to the BCD floating
point format based on the number of decimal part digits stored in the device specified by (s2), and store the converted data
in the device number specified by (d) and later.
(s1)+1
(s1)
Single-precision real number
Number of digits
(s2)
in the decimal part
(s1)+1
(s1)
3.254
27
Single-precision real number
(s2)
3
• For the sign in (d) and the exponent sign in (d)+3, 0 is set for positive and 1 is set for negative.
• For the BCD exponent in (d)+4, a value between 0 and 38 is stored.
• The number of decimal part digits of the single-precision real number data in the device specified by (s1) is stored in the
device specified by (S2). The example in the above figure shows the following.
3.25427
(s2)=3
• Six-digit BCD data, determined by rounding off the seventh digit, is stored in (d)+1 and (d)+2.
(s1)+1
(s1)
. 1 2 3 4 5 6 7 8 9
(s2)
3
• A value of 0 to 7 can be set for the number of decimal part digits in the device specified by (s2).
• When an input value is set using the engineering tool, a rounding error may occur. Refer to the following for the precautions
on setting input values using the engineering tool.
Page 49 Precautions
Operation error
Error code
Description
(SD0)
3401H
The number of decimal part digits in the device specified by (s2) is out of the range from 0 to 7.
The value set to a device or label in (s1) is -0, a subnormal number, NaN (not a number), or .
3402H
6 BASIC INSTRUCTIONS
466
6.6 Data Conversion Instructions
(d)
Sign
(d)+1
BCD (7 digits)
(d)+2
(d)+3
Sign of exponent
(d)+4
BCD exponent
(d)
(d)+1
4270H
(d)+2
0325H
(d)+3
(d)+4
(d)
0
(d)+1
1234570H
(d)+2
(d)+3
1
(d)+4
3
BCD floating-point format
0
3254270H
1
3
123456789
Rounded off.
1234570

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents