Chapter 6 Instruction Details
XBC E-Type Main Unit 6-118 Ve r. 1
6.22.2 CMP4, CMP4P, CMP8, CMP8P
Instruction
Step
P M K F L T C S Z D.x
R.x
U N D R
2~4 - - -
Operand Description Data Type
Data to compare or device’s start bit to compare
Data to compare or device’s start bit to compare
1) CMP4 (Compare Nibble)
(1) Compares OP1’s specified 4-bit with OP2’s specified 4-bit data to set applicable flag.
(2) Compares OP1 with OP2 in size to set 6 special relays’ applicable flag as its result (Unsigned Operation).
(3) 6 special relays display the result of Compare Instruction previously used.
(4) 6 special relays (F120~F125) can be used unlimitedly.
2) CMP8 (Compare Byte)
(1) Compares OP1’s specified 8-bit with OP2’s specified 8-bit data to set applicable flag.
(2) Compares OP1 with OP2 in size to set 6 special relays’ applicable flag as its result (Unsigned Operation).
(3) 6 special relays display the result of Compare Instruction previously used.
(4) 6 special relays (F120~F125) can be used unlimitedly.
3) Program Example
(1) For P01004=10 and P02008=15, if Input signal P00000 is On, F120 of Flag is set because P01004 is smaller
than P02008.
(2) Comparison range is a Nibble, so Setting is available from 0 to 15.
(3) Only compares the value which is saved from No. 4 bit of P0100 to the value which is saved from No. 8 of
P0200.