Programming Industrial Control Systems Using IEC 1131-3, Revised Edition

The elementary data types that have similar properties are organised in a hierarchy as shown in Figure 3.1.
Generic data types that start with the prefix ANY_ can be used for describing variables in function and function blocks where there is support for overloaded inputs and outputs. Overloaded refers to the ability of a variable to be used for different types of data.
For example, a function AVE() for calculating the average value of two inputs could have inputs and an output all of data type ANY_NUM. This would imply that the function can be used with any data type from the hierarchy that comes under the generic data type ANY_NUM. In other words AVE could be used with different types of numeric data, such as decimal values (REAL), or integers (INT, UINT). A number of the IEC standard functions such as MAX() are described using generic data types indicating that the same function can be used for a variety of different types of data.
| Note | A PLC manufacturer should list the functions that support data type overloading. User-defined functions cannot be overloaded, i.e. cannot be defined using the ANY_ data types. Generic data types ANY_ are not IEC keywords. |
| Note | The standard requires that all inputs and outputs for an overloaded function must be of the same data type. This should always be checked by the language compiler. |
| Note | All subranges and... |