474
FX
3U
/FX
3UC
Series Programmable Controllers
Programming Manual - Basic & Applied Instruction Edition
18 Floating Point – FNC110 to FNC139
18.5 FNC117 – EVAL / Character String to Floating Point Conversion
Related devices
→
For the use methods of the zero, borrow and carry flags, refer to Subsection 6.5.2.
Related instructions
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is
stored in D8067.
• When any character other than "30H (0)" to "39H (9)" exists in the integer part or decimal part (error code:
K6706)
• When "2EH (.)" exists in two or more positions in a character string specified by
(error code: K6706)
• When any character other than "45H (E)", "2CH (+)", "45H (E)" or "2DH (-)" exists in the exponent part, or
when two or more exponent parts exist (error code: K6706)
• When "00H" does not exist in the corresponding device range starting from
(error code: K6706)
• When the number of characters after
is "0" or more than "24" (error code: K6706)
Program examples
1) In the program example shown below, a character string stored in R0 and later is converted into binary
floating point, and stored to D0 and D1 when X000 turns ON
Device
Name
Description
Condition
Operation
M8020
Zero flag
The conversion result is true "0".
(The mantissa part is "0".)
The zero flag M8020 turns ON.
M8021
Borrow flag
The absolute value of the conversion
result is less than "2
−
126
".
The value of
is rounded to the minimum value (2
−
126
) of 32-bit real numbers, and the borrow flag M8021
turns ON.
M8022
Carry flag
The absolute value of the conversion
result is not less than "2
128
".
The value of
is rounded to the maximum value
(2
128
) of 32-bit real numbers, and the carry flag M8022
turns ON.
Instruction
Description
ESTR (FNC116)
Converts binary floating point data into a character string (ASCII codes).
STR (FNC200)
Converts binary data into a character string (ASCII codes).
VAL (FNC201)
Converts a character string (ASCII codes) into binary data.
D
D
D
S
S
X000
FNC117
DEVALP
R0
D0
END
b15
b8 b7
b0
R1
Ignored.
D1
−
1.23452
20H(space)
31H(1)
32H(2)
34H(4)
2DH(-)
30H(0)
2EH(.)
33H(3)
32H(2)
00H
35H(5)
31H(1)
Rounded.
2 3 4
1
0
1
5 2
R0
R3
R2
R5
R4
D10