FX
/FX
/FX
Series Programmable Controllers
3G
3U
3UC
Programming Manual - Basic & Applied Instruction Edition
2. 32-bit operation (DVAL and DVALP)
1)
A character string stored in
binary data acquired for conversion is stored in
+1, and the binary data is stored in [
D
1
In conversion from a character string into binary data, the data from
handled as a character string in byte units.
Command
input
FNC201
DVAL
b15
+0
ASCII code of 1st character
S
ASCII code of 3rd character
+1
+2
ASCII code of 5th character
+3
ASCII code of 7th character
+4
ASCII code of 9th character
+5
ASCII code of 11th character
00H
+6
For example, when a character string "-12345.678" is specified in
in
D
and
1
b15
31H(1)
+0
S
33H(3)
+1
35H(5)
+2
36H(6)
+3
38H(8)
+4
+5
2)
Character string to be converted
a) Number of characters of character string and the numeric range when the decimal point is ignored
Number of all characters (digits)
Number of characters (digits) of decimal part
Numeric range when decimal point is ignored
b) Character types used in characters to be converted
Sign
Decimal point
Number
3)
D
stores the number of all digits. The number of all digits indicates the number of all characters (including
1
the number, sign and decimal point).
4)
+1 stores the number of digits of the decimal part. The number of digits of the decimal part indicates the
D
1
number of all characters after the decimal point "." (2EH).
S
and later is converted into 32-bit binary data. The number of all digits of the
S
D
D
1
2
b8 b7
ASCII code indicating sign
ASCII code of 2nd character
ASCII code of 4th character
ASCII code of 6th character
ASCII code of 8th character
ASCII code of 10th character
ASCII code of 12th character
It indicates the end of character string.
D
as shown below.
2
b8 b7
b0
2DH(-)
32H(2)
34H(4)
2EH(.)
37H(7)
00H
Positive numeric value
"Space" (20 H )
Negative numeric value
"–" (2D H )
"." (2E H )
"0" (30 H ) to "9" (39 H )
26 Character String Control – FNC200 to FNC209
26.2 FNC201 – VAL / Character String to BIN Conversion
D
, the number of digits of the decimal part is stored in
1
+1,
].
D
D
2
2
S
b0
-
and later, the conversion result is stored
S
-
1
2 3
4
5
6
7
Description
2 to 13
0 to 10 and smaller than "number of all digits −3"
−2,147,483,648 to +2,147,483,647
Example: 12345.678 → "12345678"
Character type
to a device number storing "00H" is
Number of all
+0
D
digits
1
+1
Number of digits
of decimal part
+1
D
D
2
2
Integer value in
which decimal
point is ignored
32-bit binary
data
+0
10
D
1
+1
3
8
-12345678
+1
D
2
21
22
23
24
25
26
D
2
27
28
29
30
621