7-215
VAL(P),DVAL(P)
1
2
3
4
6
6
7
8
7.11 Character string processing instructions
7.11.10 Conversion from character string to BIN 16-bit or 32-bit data (VAL(P),DVAL(P))
(8) In cases where the character string designated by contains "20
H
" (space) or "30
H
" (0)
between the sign and the first numerical value other than "0", these "20
H
" and "30
H
" are
ignored in the conversion into a BIN value.
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 number of characters in the character string designated by falls outside the ranges
shown below: (Error code: 4100)
When VAL instruction is in use........... From 2 to 8 characters
When DVAL instruction is in use ........ From 2 to 13 characters
• The number of characters in the decimal fraction portion of the character string
designated by falls outside the ranges shown below: (Error code: 4100)
When VAL instruction is in use........... 0 to 5
When DVAL instruction is in use ........ 0 to 10
• The total number of characters in the character string designated by and the number of
characters in the decimal fraction part stand in a relationship that is outside the range
indicated below: (Error code: 4100)
Total number of characters minus 3 is equal to or greater than the number of characters in
the decimal fraction part.
• An ASCII code other than "20
H
" or "2D
H
" has been set for the sign.
(Error code: 4100)
• An ASCII code other than from "30
H
" to "39
H
" or "2E
H
" (decimal point) has been set as a
digit for one of the individual numbers. (Error code: 4100)
• There has been more than one decimal point set in the value. (Error code: 4100)
• The value of the BIN value when converted falls outside the following ranges:
(Error code: 4100)
When VAL instruction is in use........... 32768 to 32767
When DVAL instruction is in use ........ 2147483648 to 2147483647
•No "00
H
" is set within the range from the device number designated by to the last
device number of the relevant device. (Error code: 4101)
S
654 3 . 21
Ignored
12
2
Total number of digits
Number of digits
in decimal fraction
BIN data
0 000
5
4 321
Ignored
11
8
.
Sign
65
4
3
21
5 4 321
Total number of digits
Number of digits
in decimal fraction
BIN data
S1
S
S
S