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 miscompare; or, if all
bits compared successfully upon the next invocation of the function block, the compare
starts at the beginning.
If you want 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.
10.1.10.1
Parameters of the Masked Compare Function
Input/ Output
Choices
Description
enable
flow
Permissive logic to enable the function.
I1
R, AI, AQ
For WORD only: I, Q, M,
T, S, G
Reference for the first bit string to be compared.
I2
R, AI, AQ
For WORD only: I, Q, M,
T, S, G
Reference for the second bit string to be
compared.
M
R, AI, AQ
For WORD only: I, Q, M,
T, SS, SB, SC, G
Reference for the bit string mask.
BIT
I, Q, M, T, S, G, R, AI,
AQ, constant
Reference for the bit number where the next
comparison should start.
MC
flow, none
User logic to determine if a miscompare has
occurred.
Q
R, AI, AQ
For WORD only: I, Q, M,
T, SA, SB, SC, G
Output copy of the mask (M) bit string.
BN
I, Q, M, T, S, G, R, AI,
AQ
Bit number where the last miscompare occurred.
length
Constant
The number of words in the bit string. Max. is
4095 for WORD and 2047 for DWORD.
10.1.10.2
Operation of the Masked Compare
If all corresponding bits in strings I1 and I2 match, the function sets the “miscompare”
output MC to 0 and BN to the highest bit number in the input strings. The comparison
then stops. On the next invocation of a Masked Compare Word, it is reset to 0. When the
two bits currently being compared are not the same, the function checks the
correspondingly numbered bit in string M (the mask). If the mask bit is a 1, the
comparison continues until it reaches another miscompare or the end of the input strings.
If a miscompare is detected and the corresponding mask bit is a 0, the function does the
following:
1.
Sets the corresponding mask bit in M to 1.
2.
Sets the miscompare (MC) output to 1.
Instruction Set Reference
GFK-1503E User Manual 133
For public disclosure
Summary of Contents for VersaMax PLC
Page 16: ...Notes 16 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 38: ...Notes 38 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 50: ...Notes 50 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 92: ...Notes 92 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 112: ...Notes 112 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 224: ...Notes 224 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 292: ...Notes 292 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 316: ...Notes 316 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 317: ......