Operator ‘<INT Type>_TO_<INT Type>’

Conversion of one integer data type into another integer data type.

<INT data type>_TO_<INT data type>

Attention

Information can be lost when converting from larger data types to smaller data types. If the number to be converted exceeds the range limit, then CODESYS ignores the first bytes of the number.

Examples

Result in si: 127

ST:

si := INT_TO_SINT(4223);

If you save the integer 4223 (16#107f in hexadecimal notation) as a SINT variable, then this variable is assigned the value 127 (16#7f in hexadecimal notation).

FBD:

../_images/7da8d9c1bc98a01ac0a8640e019f55a8