OR

Top  Previous  Next

The logical operator OR operates on expressions with the BOOL, SINT, INT and DINT data types. When operating on data types other than BOOL, the operation is bitwise.

When operating on BOOL, it has the following truth table:

 

 

  Input 1     Input 2       Output1

-----------------------------------------

     0               0                0

     0               1                1

     1               0                1

     1               1                1

-----------------------------------------

 

 

 

Example:

INCLUDE rtcu.inc
 
VAR
  a : BOOL;
  b : BOOL;
  ia : INT;
  ib : INT;
END_VAR;
 
PROGRAM test;
 
BEGIN
  ...
  // Bitwise OR of ib and 16#00F0
  ia := ib OR 16#00F0;
  ...
  IF a OR b THEN
    // This will be executed if a or b are TRUE
     ...
  END_IF;
  ...
END;
 
END_PROGRAM;