471
VAL, VALP, DVAL, DVALP
1
2
3
4
4
6
7
8
7.11
Char
acter
string processing inst
ructions
7.11.1
0
VAL, VALP, DVAL, DVALP
(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.
Operat
i
on
E
rror
(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.
Program
E
xamp
l
e
(1) The following program reads the character string data stored from D20 to D22 as an integer, converts it to a BIN value,
and stores it at D0 when X0 is ON.
[Ladder Mode]
[List Mode]
Error
code
Error details
Q00J/
Q00/
Q01
QnH
QnPH QnPRH
QnU
LCPU
4100
The number of characters in the character string specified by is
outside the following ranges:
When VAL instruction is in use........2 to 8
When DVAL instruction is in use.....2 to 13
The number of characters in the decimal fraction portion of the
character string specified by is outside the following ranges:
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 specified by
and the number of characters in the decimal fraction part stand in a
relationship that is outside the following ranges:
Total number of characters -3
Number of characters in the decimal
fraction part
An ASCII code other than "20
H
" or "2D
H
" has been set for the sign.
An ASCII code other than "30
H
" to "39
H
" or "2E
H
" (decimal point) has
been set as a digit for one of the individual numbers.
There has been more than one decimal points set in the value.
The converted BIN value exceeds the following ranges:
When the VAL instruction is in use........-32768 to 32767
When the DVAL instruction is in use.....-2147483648 to 2147483647
4101
No "00
H
" is set within the range from the device number specified by
to the last device number of the corresponding device.
S
6 5
4
3
.
2 1
I
gnored
12
2
T
ota
l
number
of
d
i
g
i
ts
N
umber
of
d
i
g
i
ts
i
n
dec
i
ma
l
fract
i
on
B
IN
data
0
0 0 0 5
4
3 2 1
I
gnored
11
8
.
S
i
gn
6 5
4
3 2 1
5
4
3 2 1
T
ota
l
number
of
d
i
g
i
ts
N
umber
of
d
i
g
i
ts
i
n
dec
i
ma
l
fract
i
on
B
IN
data
S1
S
S
S
Step
I
nstruct
i
on
De
vi
ce