Chapter 6 Instruction Details
XBC E-Type Main Unit 6-117 Ve r. 1
6.22 Output Terminal Compare Instruction (Unsigned)
6.22.1 CMP, CMPP, DCMP, DCMPP
Instruction
Step
P M K F L T C S Z D.x
R.x
U N D R
2~4 - - -
Data or Data address to compare with S2
S2 Data or Data address to compare with S1 WORD/DWORD
1) CMP (Compare)
(1) Compares S1 with S2 in size to set applicable flag of 6 special relays as its result.
(Unsigned Operation)
CMP P0005 P0006
P00020
Compare to P0005 and P0006
S1
S2
1 0 1 1 0
1 1 0 0 1 1 0 1 0 1
1
1
0 1 1 0 1 1 0 0 1 1 0 1 0 1
1
Word
(2) If S1 and S2 is compared, operation result (S1=S2) is set to special flag.
(3) In the program, 6 special relays display the result of Compare Instruction previously used.
(4) 6 special relays can be used unlimitedly.
2) Program Example
(1) In case of P1000=100 and P1100=10, If Input signal P00000 is On, F123 is set because P1000 is bigger
than P1100 (P1000>P1100).