278
6 BASIC INSTRUCTIONS
6.5 Data Conversion Instructions
When the character string "-123.45" (signed) is specified by (s) and later
• The total number of characters of the character string specified by (s) is 2 to 8 characters.
• In the character string specified by (s), the number of characters that form the decimal part is 0 to 5 characters. However,
be sure to specify "Total number of digits - 3" or below.
• The range of the character string of the numeric value that can be converted to a binary value is -32768 to +32767 for a
signed value with the decimal point ignored, and 0 to 65535 for an unsigned value. A character string of a numeric value
excluding the sign and decimal point can be specified only within the range of 30H to 39H. (Value with the decimal point
ignored ... "-12345.6" becomes "-123456".)
• When representing a positive numeric value, 20H is set in the sign, and when representing a negative numeric value, 2DH
is set.
• 2EH is set in the decimal point.
• When "20H (space)" or "30H (0)" exists between the sign and the first non-zero number in a character string specified by
(s), "20H" or "30H" is ignored during conversion to a binary value.
When "20H" exists between the sign and the first non-zero number (a signed value is specified)
When "30H" exists between the sign and the first non-zero number
• Store signed data, "space (20H)" or "- (2DH)" only in the 1st byte (low-order 8 bits of the head device set in (s)). Only the
ASCII data "0 (30H)" to "9 (39H)", "space (20H)" and "decimal point (2EH)" can be stored from the 2nd byte to the "00H" at
the end of the character string in (s). If "- (2DH)" is stored in the 2nd byte or later, an operation error occurs.
Error code
(SD0/SD8067)
Description
2820 The device specified by (d1) exceeds the corresponding device range.
When "00H" is not set in the corresponding device range after the device specified in (s).
3401 The number of characters of the character string specified by (s) is other than 2 to 8 characters.
The number of characters of the decimal part of the character string specified by (s) is other than 0 to 5 characters.
The relationship between the total number of characters specified by (s) and the number of characters of the decimal part is other than
that described below.
Total number of characters - 3Number of characters in the decimal part
An ASCII code other than 20H, 2DH is set in the sign. (a signed value is specified)
An ASCII code other than 30H to 39H, and 2EH (decimal point) is set in the digits of each number
Two or more decimal points are set.
The converted binary value exceeds the range that can be converted by each instruction.
Signed operation: -32768 to +32767, unsigned operation: 0 to 65535
(s)
(s)+1
(s)+2
(s)+3
b15 b0··· ···b7b8
(d1)
(d1)+1
.
(d2)
7
2
- 1 2 3 4 5
-123 45
31H (1)
33H (3)
34H (4)
2DH (-)
32H (2)
2EH (.)
00H 35H (5)
12
3
.4
5
-
123
8
2
45-
Total number of digits
Number of digits of the decimal part
16-bit binary data
Ignore
0
.
00
12
7
4
12
Total number of digits
Number of digits of the decimal part
16-bit binary data
Ignore
Sign