10.1 Bit Operation Functions
The Bit Operation functions perform comparison, logical, and move operations on bit
strings. The Bit Operation functions are:
• Logical AND
• Logical OR
• Exclusive OR
• Logical Invert (NOT)
• Shift Right/Shift Left
• Rotate Right/Rotate Left
• Bit Test
• Bit Set, Bit Clear
• Masked Compare
• Bit Position
• Bit Sequencer
10.1.1 Data Lengths for the Bit Operation Functions
The Logical AND, OR, XOR, and NOT (Invert) functions operate on a single word of
data. The other Bit Operation functions may operate on up to 256 words.
All Bit Operation functions require Word-type data. However, they operate on data as a
continuous string of bits, with bit 1 of the first word being the Least Significant Bit
(LSB). The last bit of the last word is the Most Significant Bit (MSB). For example, if
you specified three words of data beginning at reference %R0100, it would be operated
on as 48 contiguous bits.
%R0100 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
← bit 1
(LSB)
%R0101 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17
%R0102 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33
↑
(MSB)
Overlapping input and output reference address ranges in multi-word functions is not
recommended, it can produce unexpected results.
10.1.2 Bit Operation Functions Logical AND, Logical
OR
Each scan that power is received, a Logical AND or Logical OR function examines each
bit in bit string I1 and the corresponding bit in bit string I2, beginning at the least
significant bit in each. A string length of 256 words can be selected.
10.1.2.1 Logical AND
If both bits examined by the Logical AND function are 1, a 1 is placed in the
corresponding location in output string Q. If either or both bits are 0, a 0 is placed in
string Q in that location. The Logical AND function can be used to build masks or
screens, where only certain bits are passed through (bits opposite a 1 in the mask), and all
other bits are set to 0. The Logical AND function can also be used to clear an area of
word memory by ANDing the bits with another bit string known to contain all 0s. The I1
and I2 bit strings specified may overlap.
124 GFK-1503E VersaMax PLC User Manual
For public disclosure