Typecast USINT(expression)

Top  Previous  Next

The USINT typecast operator is used to convert an expression to an USINT type. If the typecast operator is used on a "larger" type, truncation will occur.

 

 

Example:

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