Chapter 4. Ladder Diagram (LD) Programming
78
PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual
GFK-2950C
4.2.8
Masked Compare
The Masked Compare (MASK_COMP_DWORD and MASK_COMP_WORD)
function compares the contents of two bit strings. It provides the ability
to mask selected bits
Tip:
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.
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 miscompare is found or until
the end of the string is reached.
The BIT input stores the bit number where the next comparison should start. Ordinarily, this is the
same as the number where the last miscompare occurred. Because the bit number of the last
miscompare is stored in output BN, the same reference can be used for both BIT and BN. The
comparison actually begins 1 bit following BIT; therefore, the initial value of BIT should be 1 less first
bit to be compared (for example, zero (0) to begin comparison at %I00001). 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, the compare starts at the
beginning.
Tip:
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.
The function passes power flow whenever it receives power. The other outputs of the function
depend on the state of the corresponding mask bit.
If all corresponding bits in strings IN1 and IN2 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, it is reset to 0.
If a Miscompare is found
, that is, if the two bits 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.
3.
Updates the output bit string Q to match the new content of mask string M.
4.
Sets the bit number output (BN) to the number of the miscompared bit.
5.
Stops the comparison.
Summary of Contents for PACSystems RSTi-EP
Page 357: ......
Page 466: ...Chapter 9 Diagnostics GFK 2950C February 2018 451 ...