217
5-16-10UNSIGNED COMPARE: CMP(028)
Ladder Symbol
Variations
! CMP(028)
Operand Data Areas
S
1
: Comparison word 1 CIO, G, A, T, C, #, DM, DR, IR
S
2
: Comparison word 2 CIO, G, A, T, C, #, DM, DR, IR
(
028
)
CMP S
1
S
2
When the execution condition is OFF, CMP(028) is not executed. When the ex-
ecution condition is ON, CMP(028) compares constants and/or the contents of
specified words as unsigned 16-bit binary data and changes the status of com-
parison flags according to the results.
After CMP(028) execution, the A50005 (GR), A50006 (EQ), and A50007 (LE)
flags turn ON and OFF as shown in the following table.
Comparison result A50005 (GR) A50006 (EQ) A50007 (LE)
S
1
> S
2
ON OFF OFF
S
1
= S
2
OFF ON OFF
S
1
< S
2
OFF OFF ON
Flags ER (A50003): Content of *DM word is not BCD when set for BCD.
GR (A40213), EQ (A50006), LE (A50007): (Refer to tables above.)
5-16-11 DOUBLE UNSIGNED COMPARE: CMPL(029)
(
029
)
CMPL S
1
S
2
Ladder Symbol
Operand Data Areas
S
1
: First comparison word 1 CIO, G, A, T, C, #, DM,
S
2
: First comparison word 2 CIO, G, A, T, C, #, DM,
When the execution condition is OFF, CMPL(029) is not executed. When the ex-
ecution condition is ON, CMPL(029) compares constants and/or the contents of
specified sets of words as unsigned 32-bit data and changes the status of com-
parison flags according to the results. The content of S
1
and S
1
+1 is compared
to that of S
2
and S
2
+1.
After CMPL(029) execution, the A50005 (GR), A50006 (EQ), and A50007 (LE)
flags turn ON and OFF as shown in the following table.
Comparison result A50005 (GR) A50006 (EQ) A50007 (LE)
S
1
+ 1, S
1
> S
2
+ 1, S
2
ON OFF OFF
S
1
+ 1, S
1
= S
2
+ 1, S
2
OFF ON OFF
S
1
+ 1, S
1
< S
2
+ 1, S
2
OFF OFF ON
Flags ER (A50003): Content of *DM word is not BCD when set for BCD.
GR (A40213), EQ (A50006), LE (A50007): (Refer to tables above.)
Example When CIO 000000 is ON in the following example, the content of CIO 0011 and
CIO 0010 is compared with that of CIO 0009 and CIO 0008 as binary data.
• If the content of CIO 0011 and CIO 0010 is greater than that of CIO 0009 and
CIO 0008, then output CIO 002000 will turn ON.
• If the content of CIO 0011 and CIO 0010 is equal to that of CIO 0009 and
CIO 0008, then output CIO 002001 will turn ON.
Description
Description
(CVM1 V2)
(CVM1 V2)
Comparison Instructions Section 5-16