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
logical and
&&
Note that the Logix Designer application allows AND as a logical operator. In FactoryTalk Design Studio, you must use && for a logical and.
logical or
||
logical exclusive or
^^
logical complement
!
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 || 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 || (temp<100) then...
expression1 ^^ 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 ^^ 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
Have questions or feedback about this documentation? Please submit your feedback here.
Normal