Typecast DINT(expression)

Top  Previous  Next

The DINT typecast operator is used to convert an expression to a DINT type. If the typecast is used to convert from a "smaller" type, sign extension will occur.

 

 

Example:

INCLUDE rtcu.inc
 
VAR
  a : INT;
  b : DINT;
END_VAR;
 
PROGRAM test;
 
// Convert 'a' which is a INT type to a DINT (sign extension will occur)
b := DINT(a);
 
END_PROGRAM;