5 Applied Functions
5.1 Type Conversion Functions
82
FXCPU Structured Programming Manual
(Application Functions)
5.1.24 REAL_TO_DINT(_E)
Outline
This function converts float (single precision) data into double word [signed] 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
This function converts float (single precision) data stored in a device specified in
into double word
[signed] data, and outputs the data obtained by conversion to a device specified in
.
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
3) The function is provided in the FX
3G
Series Ver.1.10 or later.
4) In the data obtained by conversion, the portion after the decimal point of the float (single precision) data
(source data) is rounded off.
FX
3U(C)
FX
3G
FX
2N(C)
FX
1N(C)
FX
1S
FX
U
/FX
2C
FX
0N
FX
0(S)
Function name
Expression in each language
Structured ladder
ST
REAL_TO_DINT
REAL_TO_DINT(a_real);
Example:
Label 2:=
REAL_TO_DINT(Label 1);
REAL_TO_DINT_
E
REAL_TO_DINT_E(EN,a_real,
Output label);
Example:
REAL_TO_DINT_E(X000, Label 1,
Label 2);
Variable
Description
Data type
Input
variable
EN
Execution condition
Bit
a_real (
)
Conversion source float (single precision) data
FLOAT (Single Precision)
Output
variable
ENO
Execution status
Bit
*1
(
)
Double word [signed] data after conversion
Double Word [signed]
REAL_TO_DINT
a_real
*1
Label 2
Label 1
REAL_TO_DINT_E
EN
ENO
*1
Label 2
X000
Label 1
a_real
s
d
s
d
16543521.0
16543521
FLOAT (single precision) data
Double word [signed] data
The portion after the decimal
point is rounded off.