Introduction
Control Expert provides a set of optional implicit type conversion. By checking the option in Project Settings the types conversions are implicitly done and you do not need to use most of the explicit type to type functions you used before.
Implicit Type Conversion Rules
After an implicit conversion, system bit %S18 is set to one to indicate a possible side-effect:
loss of accuracy
range mismatches
unexpected implementation-dependent behavior
The formal test of the value of system bit %S18 is the responsibility of the programmer, the application must manage the behavior of its operative part.
NOTICE | |
---|---|
The implicit type conversion rules:
Precedence |
Target Data Type |
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Source Data Type |
REAL |
DINT |
INT |
UDINT |
UINT |
DWORD |
WORD |
BYTE |
BOOL |
|
REAL |
x |
I |
I |
I |
I |
E |
E |
E |
E |
|
DINT |
I |
x |
I |
I |
I |
I |
I |
I |
E |
|
INT |
I(IEC) |
I(IEC) |
x |
I |
I |
I |
I |
I |
E |
|
UDINT |
I |
I |
I |
x |
I |
I |
I |
I |
E |
|
UINT |
I(IEC) |
I(IEC) |
I |
I(IEC) |
x |
I |
I |
I |
E |
|
DWORD |
I |
I |
I |
I |
I |
x |
I |
I |
E |
|
WORD |
I |
I |
I |
I |
I |
I(IEC) |
x |
I |
E |
|
BYTE |
I |
I |
I |
I |
I |
I(IEC) |
I(IEC) |
x |
E |
|
BOOL |
I |
I |
I |
I |
I |
I(IEC) |
I(IEC) |
I(IEC) |
x |
|
x: No data type conversion is necessary. I: Implicit data conversions available in Control Expert in addition to the IEC recommendations. If the result of the conversion does not fit the Data Type, the implicit conversion is done and system bit %S18 is set. I(IEC): Implicit data conversions in Control Expert that meet the IEC recommendations; explicit type conversions are allowed. E: Explicit data type conversions are required. |