Typecast BYTE(expression)

Top  Previous  Next

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

 

 

Example:

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