Logical operators, Bitwise operators – Rockwell Automation 9301 Series RSView32 Users Guide User Manual
Page 525

14–12
RSView32 User’s Guide
Logical operators
Logical operators determine the validity of one or more statements.
There are three logical operators: AND, OR, and NOT. The operators
return a non–zero value if the expression is true, or a zero if the
expression is false.
The logical operators are:
Bitwise operators
Bitwise operators examine and manipulate individual bits within a
value.
Symbols
Operator
Action
Example
(For these examples, tag1 = 5 and
tag2 = 7)
AND,
&&
and
Returns a 1 if the
statements to the right
and to the left of the
operator are both true.
(tag1 < tag 2) AND (tag1 == 5)
both statements are true; returns a 1
OR, ||
or
Returns a 1 if either
the statement to the
left or to the right of
the operator is true.
(tag1 > tag2) OR (tag1 == 5)
tag1 == 5 is true; returns a 1
NOT
negation
Reverses the logical
value of the statement
it operates on.
NOT(tag1 < tag2)
although tag1 < tag2 is true, NOT reverses
the logical value; returns a 0
The parentheses are essential in the above expressions. See
“Evaluation order of operators” on page 14-22.
IMPORTANT
These operators are for integers only, not floating point numbers.
IMPORTANT