Conversion instructions
187
Part II IEC Instructions
REAL_TO_UDINT
REAL into unsigned DOUBLE INTEGER
See also:
TRUNC_TO_UDINT (see page 187)
To add an enable input and enable output to the instruction, select [With EN/ENO] from the
"Instructions" pane (LD, FBD or IL editor). To reuse an instruction select "Recently used" from the
context menu or press <Ctrl>+<Shift>+<v> in the programming window.
PLC types
Availability of REAL_TO_UDINT (see page 1330)
Since REAL numbers only have a resolution of about 7 digits, information for
large numbers will be lost.
Data type I/O Function
REAL Input input data type
UDINT Output conversion result
Description
REAL_TO_UDINT converts a value of the data type REAL into a value of the data type Unsigned
DOUBLE INTEGER. The result is rounded off to the nearest whole number for the conversion.
Data types
Example
In this example the function has been programmed in ladder diagram (LD) and structured text (ST).
POU header
All input and output variables used for programming this function have been declared in the POU
header.
LD
ST
When programming with structured text, enter the following:
UDINT_value := REAL_TO_UDINT(REAL_value);