beautypg.com

Rockwell Automation 9301 Series RSView32 Users Guide User Manual

Page 526

background image

Creating expressions

14–13

Symbol

Operator

Action

&

AND

Compares two integers or integer tags on a bit–by–bit basis.

Returns an integer with a bit set to 1 if both the corresponding bits
in the original numbers are 1. Otherwise, the resulting bit is 0.

|

inclusive OR

Compares two integers or tags on a bit–by–bit basis.

Returns an integer with a bit set to 1 if either or both of the
corresponding bits in the original numbers are 1. If both bits are 0,
the resulting bit is 0.

^

exclusive OR
(XOR)

Compares two integers or tags on a bit–by–bit basis.

Returns an integer with a bit set to 1 if the corresponding bits in
the original numbers differ. If both bits are 1 or both are 0, the
resulting bit is 0.

>>

right shift

Shifts the bits within an integer or tag to the right.

Shifts the bits within the left operand by the amount specified in
the right operand. The bit on the right disappears.

Either a 0 or a 1 is shifted in on the left, depending on whether the
left–most bit is a 0 or a 1. If the left–most bit is 0, a 0 is shifted in.
If the left–most bit is 1, a 1 is shifted in. In other words, the sign of
the number is preserved.

<<

left shift

Shifts the bits within an integer or tag to the left.

Shifts the bits within the left operand by the amount specified in
the right operand. The bit on the left disappears and 0 always
shifts in on the right.

~

complement

Returns one’s complement; that is, it toggles the bits within an
integer or tag.

Reverses every bit within the number so every 1 bit becomes a 0
and vice versa.