Omron CJ - REFERENCE MANUAL 10-2009 Reference Manual page 302

Table of Contents

Advertisement

3. Instructions
Flags
Name
Error Flag
Equals Flag
Function
MCMP(019) compares the contents of the 16 words
S
through S
+15 to the contents of the 16 words
1
1
S
through S
+15, and turns ON the corresponding
2
2
bit in word R when the contents are not equal.
The content of S
S
, the content of S
2
and the content of S
Bit n of R is turned OFF if the content of S
equal to the content of S
ON if the contents are not equal.
Hint
• If the contents of all 16 pairs of words are the same, the Equals Flag will turn ON after the instruction
has been executed.
Sample program
When CIO 0.00 is ON in the following example, MCMP(019) compares words D100 through D115 in
order to words D200 through D215 and turns ON the corresponding bits in D300 when the words are
not equal.
0.00
MCMP
D100
S1
D200
S2
D300
D
264
Label
ER
OFF
=
• ON if the result word is 0000.
(The two 16-word sets contain the same data.)
• OFF in all other cases.
is compared to the content of
1
+1 to the content of S
1
+15 to the content of S
1
+n; bit n of R is turned
2
S1: D100
1 2 3 4
D101
5 6 7 8
D102
9 A B C
D103
D E F 0
D104
0 2 0 0
D105
1 2 3 4
D106
5 6 7 8
D107
9 A B C
D108
D E F 0
D109
1 2 3 4
D110
5 6 7 8
D111
9 A B C
D112
0 2 0 0
D113
1 2 3 4
D114
5 6 7 8
D115
9 A B C
Operation
Comparison
S1
S1+1
+1, ...,
2
+15.
S1+14
2
+n is
S1+15
1
S2: D200
D201
D202
D203
D204
D205
D206
D207
D208
D209
D210
D211
D212
D213
D214
D215
CS/CJ/NSJ Series Instructions Reference Manual (W474)
0: Words are equal.
1: Words aren't equal.
R
S2
S2+1
S2+14
S2+15
R: D300
1 2 3 4
0
0
9 A B C
1
1
5 6 7 8
1
2
D E F 0
0
3
0 2 0 0
0
4
5 6 7 8
1
5
9 A B C
1
6
D E F 0
1
7
1 2 3 4
1
8
5 6 7 8
1
9
0 2 0 0
1
1 0
1 2 3 4
1
1 1
0 2 0 0
0
1 2
5 6 7 8
1
1 3
9 A B C
1
1 4
1 2 3 4
1
1 5
0
1
14
15

Advertisement

Table of Contents
loading

Table of Contents