Generic Data Types

Help Contents

Introduction

A Generic Data Type declares a range of data types is acceptable.

A Generic Data Type begins with the prefix ANY:

Generic Data TypeImplied Types
ANYAny type elementary or structured
ANY_ELEMENTARYANY_MAGNITUDE, ANY_BIT, ANY_CHARS, or ANY_DATE
ANY_MAGNITUDEANY_INT, ANY_REAL, or TIME
ANY_INTEGRALANY_INT, or ANY_BIT
ANY_NUMANY_INT, or ANY_REAL
ANY_REALREAL, LREAL
ANY_INTSINT, INT, DINT, LINT, USINT, UINT, UDINT, ULINT
ANY_UNSIGNEDUSINT, UINT, UDINT, ULINT
ANY_SIGNEDSINT, INT, DINT, LINT
ANY_BITBOOL, BYTE, WORD, DWORD, LWORD
ANY_CHARSANY_CHAR, ANY_STRING
ANY_CHARCHAR, WCHAR
ANY_STRINGSTRING, WSTRING
ANY_DATEDATE_AND_TIME, DATE

Remarks

A Generic Data Type describes the parameters to some built-in functions. For example, the ABS() function supports SINT, INT, DINT, LINT, REAL, LREAL and TIME.

In user-defined code, a Generic Data Type may be used to describe the input parameters to a FUNCTION:

Function GetTypeName : STRING
Var_Input
    Value : ANY_MAGNITUDE;
End_Var

    IF IsTypeOf( Value, ANY_INT ) THEN

        GetTypeName := 'Integer';

    ELSEIF IsTypeOf( Value, ANY_REAL ) THEN

        GetTypeName := 'Floating Point';

    ELSE

        GetTypeName := 'Interval';

    END_IF
End_Function

Standards Compliance

Table 11 - IEC 61131-3 Second Edition.

Figure 5 - IEC 61131-3 Third Edition.

Further Information

Elementary Data Types

To learn about elementary data types.

Common Elements

To learn about other language Common Elements.

Glossary

For the meaning of terms used in Fernhill SCADA.