Conversion instructions
199
Part II IEC Instructions
STRING_TO_REAL
STRING to REAL
Thereby the attached string is first converted to a value of the data type STRING[32]. Finally this is
converted to a value of the data type REAL via a sub-program that requires approximately 290
steps.
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.
Example with and without EN/ENO:
Permissible format:
'[Space][Sign][Decimal numbers].[Decimal numbers][Space]' e.g. ' -123.456 '
Permissible characters:
Space All characters except for "+“ (plus), "-" (minus) and all decimal numbers
Decimal
numbers
Decimal numbers "0“-"9“
The analysis ends with the first non-decimal number.
PLC types Availability of STRING_TO_REAL (see page 1331)
Data type Comment
STRING input variable
REAL output variable
Description
function converts a STRING in floating-point format into a value of the data type REAL.
Data types