Conversion Functions

Help Contents


Conversion functions convert from one Elementary Data Type to another. Some conversion functions operate as simple cast operations, changing the type without changing the value. For example INT_TO_REAL( 100 ). Other conversion functions may change the value as well as the type. For example WORD_BCD_TO_INT( 16#9999 ).

Standard conversion functions

These standard conversion functions are supported:

Conversion Function Name Description
Type Conversion *_TO_** Simple conversion, changing from type * to type **
Truncation *_TRUNC_** Real to integer conversion, changing from real type * to integer type **
BCD To Integer *_BCD_TO_** Change from Binary Coded Decimal (BCD) type * to integer type **
Integer To BCD *_TO_BCD_** Change from integer type * to Binary Coded Decimal (BCD) type **

Standards Compliance

IEC 61131-3 Second Edition: Table 22.

IEC 61131-3 Third Edition: Table 22.

Extension Functions

These functions that extend the IEC 61131-3 standard are also supported:

Function Version Explanation
FORMAT_DATE_TIME 3.36 Converts a DATE and TIME value to a string using a custom format.
FORMAT_INTEGER 3.80 Converts an integer to a string using a defined number base.
FORMAT_NUMBER 3.73 Converts a number to a string using a custom format.
LOG_REASON_TO_STRING 3.32 Translates a change reason in a string.
QUALITY_TO_STRING 3.00 Translates a quality value in a string.
TO_SQL_LITERAL 3.32 Converts a value to an SQL Literal.

Further Information

Common Elements

To learn about other common language elements.


For the meaning of terms used in Fernhill SCADA.