Semantic Error (SEM1189): The data type '...' of the expression attached to the parameter '...' of the function '...' cannot be implicitly converted to '...'.
The system allows the IEC 61131-compliant implicit data type conversion: particular data types are implicitly converted into another data type if both are used within the same expression. If possible, the implicit type conversion makes the use of an IEC 61131 type conversion function superfluous.
Examples: in the following example, variables of different data types are implicitly converted in assignments or passed as function parameters.
The possible implicit type conversions are listed below. For any other data type combination, this error is reported. In case of an error, an IEC 61131 standard type converter function has to be used before.
As standard rule applies: only smaller data types can be implicitly converted to greater data types. "Greater to smaller" is not possible at all.
- SINT >>>: INT DINT LINT REAL LREAL
- INT >>>: DINT LINT REAL LREAL
- DINT >>>: LINT LREAL
- USINT >>>: UINT UDINT ULINT INT DINT LINT REAL LREAL
- UINT >>>: UDINT ULINT DINT LINT REAL LREAL
- UDINT >>>: ULINT LINT LREAL TIME
- BOOL >>>: BYTE WORD DWORD LWORD
- BYTE >>>: WORD DWORD LWORD
- WORD >>>: DWORD LWORD
- DWORD >>>: LWORD
- REAL >>>: LREAL
- TIME >>>: UDINT
Further Info
For information on the value ranges of elementary data types refer to the topic "Elementary Data Types according to IEC 61131-3 ![]() ×‣ Elementary Safety-Related Data Types ×". |