7-209
STR(P),DSTR(P)
1
2
3
4
6
6
7
8
7.11 Character string processing instructions
7.11.9 Conversion from BIN 16-bit or 32-bit to character string (STR(P),DSTR(P))
(c) If the total number of digits following the decimal fraction is greater than the number of
BIN data digits, a zero will be added automatically and the number converted by shifting
to the right, so that it would become "0. ".
(d) If the total number of digits excluding the sign and the decimal point is greater than the
number of BIN data digits, "20
H" (space) will be stored between the sign and the
numeric value.
If the number of BIN digits is greater, an error will be returned.
(e) The value "00
H" is automatically stored at the end of the converted character string.
Operation Error
(1) In any of the following cases, an operation error occurs, the error flag (SM0) turns ON, and
an error code is stored into SD0.
• The total number of digits designated by is outside the ranges shown below.
(Error code: 4100)
When the STR instruction is in use .......2 to 8
When the DSTR instruction is in use.....2 to 13
• The number of digits designated as a part of the decimal fraction by +1 is outside the
range shown below. (Error code: 4100)
When the STR instruction is in use .......0 to 5
When the DSTR instruction is in use.....0 to 10
• The relationship between the total number of digits designated by and the number of
digits in the decimal fraction designated by +1 is not as shown below:
(Error code: 4100)
Total number of digits minus 3 is equal to or larger than the number of digits in the decimal
fraction.
• The number of digits designated by is smaller than "2 + number of digits of the BIN
data, designated by ".
(Number of digits of < Number of digits of the BIN data at without a sign + Number
of digits of a sign (+ or -) + Number of digits of decimal point (.)) (Error code: 4100)
• The device range where the character string designated by will be stored exceeds the
relevant device range. (Error code: 4101)
5
4 321
13
10
0
.
000005
4
3
21
Automatically added
Total number of digits
Number of digits
in decimal fraction
BIN data
5
4321
0
13
2
5
4
3
2. 1
0
Filled with 20H (space) codes
Total number of digits
Number of digits
in decimal fraction
BIN data
S1
S1
S1
S1
S1
S2
S1
S2
D