5 Applied Functions
5.1 Type Conversion Functions
113
FXCPU Structured Programming Manual
(Application Functions)
1
Outline
2
Function List
3
Function
Construction
4
How to Read
Explanation of
Functions
5
Applied
Functions
6
Standard
Function Blocks
A
Correspondence
between Devices
and Addresses
5.1.39 STR_TO_REAL(_E)
Outline
This function converts string data into float (single precision) data, and outputs the data obtained by
conversion.
1. Format
*1. Output variable
2. Set data
In explanation of functions, I/O variables inside ( ) are described.
Explanation of function and operation
1) This function converts string data (in the decimal format or exponent format) stored in a device specified
in into float (single precision) data, and outputs the data obtained by conversion to a device specified
in .
2) The conversion source string data can be in the decimal format or exponent format.
a) In the case of decimal format
FX3U(C) FX3G FX2N(C) FX1N(C) FX1S
FX
U
/FX
2C
FX0N FX0(S)
Function name
Expression in each language
Structured ladder ST
STR_TO_REAL
STR_TO_REAL(_STRING);
Example:
Label 2:=
STR_TO_REAL(Label 1);
STR_TO_REAL_E
STR_TO_REAL_E(EN,_STRING,
Output label);
Example:
STR_TO_REAL_E(X000, Label 1,
Label 2);
Variable Description Data type
Input
variable
EN Execution condition Bit
_STRING ( )
Conversion source string data String
Output
variable
ENO Execution status Bit
*1 ( )
Float (single precision) data after conversion FLOAT (Single Precision)
STR_TO_REAL
_STRING *1
Label 1 Label 2
STR_TO_REAL_E
EN ENO
*1
Label 2
X000
Label 1
_STRING
s
d
s
d
ASCII code for 1st character
High-order byte
ASCII code for 3rd character
ASCII code for 2nd character
ASCII code for 4th character
ASCII code for 5th character
ASCII code for 7th character
ASCII code for 9th character
ASCII code for 11th character
ASCII code for 8th character
ASCII code for 6th character
ASCII code for 10th character
Sign data
Low-order byte
String 1st word
2nd word
3rd word
4th word
5th word
6th word
7th word
0000H (Indicates the end of the character string.)
Float (single precision) data
31H (1)
High-order byte
33H (3) 2EH (.)
35H (5)30H (0)
34H (4)
33H (3) -1.35034
2DH (-)
Low-order byte
String 1st word
2nd word
3rd word
4th word
5th word
Float (single precision)
data
0000H
-1.35034