4-68 Series 90-30/20/Micro Programmable Controllers Reference Manual September 1998 GFK-0467K
4
Example:
In the following example, after first scan, the MSKCMPW function block is executed. %M0001
through %M0016 is compared with %M0017 through %M0032. %M0033 through %M0048
contains the mask value. The value in %R0001 determines at which bit position the comparison
starts within the two input strings. The contents of the above references before the function block is
executed are as follows:
(I1 ) – %M0001 = 6C6Ch =
0110110001101100
(I2) – %M0017 = 606Fh =
0110110101101111
(M/Q) – %M0033 = 000Fh =
0000000000001111
(BIT/BN) – %R0001 = 0
(MC) – %Q0001 = OFF
The contents of these references after the function block is executed are as follows:
(I1) – %M0001 =
0110110001101100
(I2) – %M0017 =
0110110101101111
(M/Q) – %M0033
0000000100001111
(BIT/BN) – %R0001 = 8
(MC) – %Q0001 = ON
Ladder Diagram Representation
| _____
|FST_SCN | |
|——| |———|MASK_|
| | |
| |COMP_|
| | WORD| %Q0001
|%M0001 -|I1 MC|—————————————————————————————————————————————————————————————(S)-
| | LEN |
| |00001|
|%M0017 -|I2 Q|- %M0033
| | |
| | |
|%M0033 -|M BN|- %R0001
| | |
| | |
|%R0001 -|BIT |
| |_____|
Notice that, in the example shown above, we used the FST_SCN contact to force one and only one
execution; otherwise the masked compare would repeat, not necessarily delivering the desired results.