User Manual
Chapter 23
GFK-1645M
Dec 2019
Instruction Set Reference
434
Example
In the example, whenever input %I0001 is set, bit 12 of the string beginning at reference
%R0040 is set to 1.
Figure 253
23.1.9
Bit Operation Functions
Masked Compare
The Masked Compare function compares the contents of two separate bit strings. It
provides the ability to mask selected bits. Input string 1 might contain the states of outputs
such as solenoids or motor starters. Input string 2 might contain their input state feedback,
such as limit switches or contacts.
Figure 254
When the function receives power flow, it begins comparing the bits in the first string with
the corresponding bits in the second string. Comparison continues until a miss-compare is
found or until the end of the string is reached.
The BIT input stores the bit number where the next comparison should start (a 0 indicates
the first bit in the string). The BN output stores the bit number where the last comparison
occurred (where a 1 indicates the first bit in the string). Using the same reference for BIT
and BN causes the compare to start at the next bit position after a miss-compare; or, if all
bits compared successfully upon the next invocation of the function block, the compare
starts at the beginning.
To start the next comparison at some other location in the string, you can enter different
references for BIT and BN. If the value of BIT is a location that is beyond the end of the string,
BIT is reset to 0 before starting the next comparison.