TRUE, ON

Top  Previous  Next

TRUE and ON are both synonymous for the same thing. They are used when assigning a constant to a variable of the type BOOL.

 

 

Example:

INCLUDE rtcu.inc
 
VAR
  var : BOOL;
END_VAR;
 
PROGRAM test;
 
BEGIN
  var := TRUE; // This sets the variable var to TRUE (the same as setting it to ON)
  var := ON;   // This sets the variable var to ON (the same as setting it to TRUE)
 
  var := BOOL(1); // This makes a typecast on the value 1 (an integer) and assigns it to var (the same as TRUE/ON)
END;
 
END_PROGRAM;