Conversion Functions

Help Contents

Introduction

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

Table 22 - IEC 61131-3 Second Edition.

Table 22 - IEC 61131-3 Third Edition.

Extension Functions

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

Function Explanation
FORMAT_DATE_TIME Converts a DATE and TiME value to a string using a custom format.
LOG_REASON_TO_STRING Translates a change reason into a string.
QUALITY_TO_STRING Translates a quality value into a string.
TO_SQL_LITERAL Converts a value to an SQL Literal.

Further Information

Common Elements

To learn about other common language elements.

Glossary

For the meaning of terms used in Fernhill SCADA.