Chapter 6 Instruction Details
XBC E-Type Main Unit
6-118
Ver. 1
6.22.2 CMP4, CMP4P, CMP8, CMP8P
Instruction
Area Available
Step
Flag
P M K F L T C S Z D.x R.x
Co
nst.
U N D R
Error
(F110)
Zero
(F111)
Carry
(F112)
CMP4(P)
CMP8(P)
S1 O O O - O -
-
-
- O O O O - O O
2~4
-
-
-
S2 O O O - O -
-
-
- O O O O - O O
Operand
Description
Data Type
S1
Data to compare or device’s start bit to compare
NIBBLE/BYTE
S2
Data to compare or device’s start bit to compare
NIBBLE/BYTE
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.
CMP4 P01004 P02008
P00000
CMP4, CMP8
P
S
1
S2
CMP4P,
CMP8P
S
1
S2
means
Summary of Contents for XBC-DN10E
Page 1: ......
Page 10: ...Table of Contents Table of Contents 6 10 10 CLEAR ALL PLC 29...