Use logical operators
    Use logical operators to verify if multiple conditions are true or false. The result of a logical operation is a BOOL value.
If the comparison is  | The result is  | 
true  | 1  | 
false  | 0  | 
Use these logical operators.
For this comparison  | Use this operator  | Optimal data type  | 
logical AND  | &, AND  | BOOL  | 
logical OR  | OR  | BOOL  | 
logical exclusive OR  | XOR  | BOOL  | 
logical complement  | NOT  | BOOL  | 
The table provides examples of using logical operators.
Use this format  | Example  | |
For this situation  | Use  | |
BOOLtag  | If photoeye is a BOOL tag and your specification says: "If photoeye_1 is on then..."  | IF photoeye THEN...  | 
NOT BOOLtag  | If photoeye is a BOOL tag and your specification says: "If photoeye is off then..."  | IF NOT photoeye THEN...  | 
expression1 & expression2  | If photoeye is a BOOL tag, temp is a DINT tag, and your specification says: "If photoeye is on and temp is less than 100 then..."  | IF photoeye & (temp<100) THEN...  | 
expression1 OR expression2  | If photoeye is a BOOL tag, temp is a DINT tag, and your specification says: "If photoeye is on or temp is less than 100 then...".  | IF photoeye OR (temp<100) THEN...  | 
expression1 XOR expression2  | If photoeye1 and photoeye2 are BOOL tags and your specification says: "If: photoeye1 is on while photoeye2 is off or photoeye1 is off while photoeye2 is on then..."  | IF photoeye1 XOR photoeye2 THEN...  | 
BOOLtag := expression1 & expression2  | If photoeye1 and photoeye2 are BOOL tags, open is a BOOL tag, and your specification says: "If photoeye1 and photoeye2 are both on, set open to true"  | open := photoeye1 & photoeye2;  | 
Provide Feedback