552
7 APPLICATION INSTRUCTIONS
7.11 Character String Processing Instructions
■STR
• Adds a decimal point to the BIN 16-bit data designated by (S2) at the location designated by (S1), converts the data to
character string data, and stores it in the area starting from the device number designated by (D).
• The total number of digits that can be designated by (S1) is from 2 to 8.
• The number of digits that can be designated by (S1)+1 as a part of the decimal fraction is from 0 to 5. However, the number
of digits following the decimal point must be smaller than or equal to the total number of digits minus 3.
• BIN data in the range between -32768 and 32767 can be designated at (S2).
• The converted character string data is stored at the area starting from the device number (D) as indicated below:
• The sign "20H" (space) will be stored if the BIN data is positive, and the sign "2DH" (minus sign) will be stored if it is negative.
• If the setting for the number of digits after the decimal fraction is anything other than "0", "2EH" (.) will automatically be stored at the position before the first of
the specified number of digits. If the number of digits in the decimal fraction part of the number is "0", the ASCII code "2EH" (.) will not be stored.
• 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.".
• If the total number of digits excluding the sign and the decimal point is greater than the number of BIN data digits, "20H" (space) will be stored between the
sign and the numeric value. If the number of BIN digits is greater, an error will be returned.
• The value "00H" is automatically stored at the end of the converted character string.
Total number of digits
Number of digits in decimal fraction
BIN data
Sign
.
S1
S1
S2
ASCII code for the
(total number of digits -1)
th digit
ASCII code for the
(total number of digits -3)
th digit
ASCII code for the
(total number of digits -5)
th digit
ASCII code for the
(total number of digits -7)
th digit
ASCII code for the sign
ASCII code for the
(total number of digits -2)
th digit
ASCII code for the
(total number of digits -4)
th digit
ASCII code for the
(total number of digits -6)
th digit
D
D
D
D
D
b15 b8b7
b0
Designated total
number of digits
Automatically stored at
the end of the character string
00
H
5
1
+1
1 2 3
.
+2
31
H
(1)
32
H
(2)2E
H
(.)
b15 b7
b0
33
H
(3)
00
H
+1
12
3
S1
S2
D
S1
D
D
2D
b8
( )
6
2
Total number of digits
Number of digits
in decimal fraction
BIN data
12 34
Number of digits in decimal fraction
1234
Automatically added
.
6
3
0
.1
2
Automatically added
12
0
Total number of digits
Number of digits
in decimal fraction
BIN data
8
1
1
2
Filled with 20H (space)
.
3
12
3
Total number of digits
Number of digits
in decimal fraction
BIN data