7-190
7.11 String Processing Instructions
7.11.10 Character string data to 16-/32-bit BIN data conversion
VAL, DVAL
Function
VAL(P)
(1) Converts character string data stored in the device specified for
and the following devices
to 16-bit BIN data, and stores the number of digits and BIN data to
and
.
For converting character string data to BIN data, all data from the device specified for
to
the device where 00
H
is stored will be processed as character string data.
For example, if the character string 123.45 is specified for the devices following
, the
result would be stored to
and
as shown below.
(2) The total number of characters that can be specified as a character string for
is from 2 to
8 characters.
(3) From 0 to 5 characters from the character string specified for
can become the decimal
fraction.
However, this number must not exceed the total number of digits minus 3.
(4) The range of the numeric character string that can be converted to BIN value is from
32768 to 32767, ignoring a decimal point.
Numeric value character strings, excluding the sign and the decimal point, can be specified
only within the range from 30
H
to 39
H
.
The value ignoring a decimal point means:
:
12345.6 123456
(5) The sign 20
H
will be stored if the numeric value is positive, and the sign 2D
H
will be stored if
it is negative.
(6) 2E
H
is set for the decimal point.
(7) The total number of digits stored to
is the total number of characters that represent
numeric values including a sign and decimal point.
The number of digits for decimal fraction stored to
+1 is the number of characters that
represent decimal fraction separated by 2E
H
(. ).
The BIN data stored to
is the character string ignoring the decimal point that has been
converted to BIN value.
s
d1
d2
s
.
S
ign
1
st
char-
acter
2
n
d
char-
acter
7
th
char-
acter
Total num
b
er
of
d
igits
Num
b
er of
d
igits
in
d
ecimal fraction
Integer value
ignoring
d
ecimal
point
BIN
16
b
its
In
d
icates the en
d
of character string
ASC
II co
d
e for the sign
ASC
II co
d
e for the
1
st character
ASC
II co
d
e for the
2
n
d
character
ASC
II co
d
e for the
3
r
d
character
ASC
II co
d
e for the 4th character
00
H
ASC
II co
d
e for the
5
th character
ASC
II co
d
e for the
6
th character
ASC
II co
d
e for the
7
th character
d1
d2
s
s
s
s
s
d1
[
0
]
[
1
]
[
2
]
[
3
]
[4]
b15
b8 b7
b0
+
1
s
d1
d2
.
7
2
1 2 3 4 5
+1
2
D
H
( )
31
H
(1)
32
H
(2)
33
H
(3)
b15
b8 b7
b0
2E
H
(.)
34
H
(4)
35
H
(5)
00
H
[3]
[2]
[1]
[0]
1 2 3
4 5
s
s
s
s
d2
d1
d1
s
s
Example
d1
d1
d2
Summary of Contents for MELSEC Q Series
Page 1: ...Structured Programming Manual Mitsubishi Programmable Controller QCPU Common Instructions ...
Page 2: ......
Page 14: ...A 12 MEMO ...
Page 340: ...6 178 MEMO MTR ...
Page 708: ...7 368 MEMO ...
Page 776: ...8 68 MEMO ...
Page 796: ...9 20 MEMO ...
Page 804: ...App 8 MEMO ...
Page 812: ...Index 8 MEMO ...
Page 815: ......