6 BASIC INSTRUCTIONS
6.1 Comparison Operation Instructions
231
6
■Applicable devices
• These instructions compare the (n) points of 16-bit binary data from the device specified by (s1) with the (n) points of 16-bit
binary data from the device specified by (s2), and stores the operation result in the device specified by (d) and later.
• If the comparison condition is satisfied, the relevant device specified by (d) turns on; otherwise, the device turns off.
• Specify data in units of 16 bits.
• A constant can be specified for (s1).
• The following table lists the comparison operation results of each instruction.
• When the comparison operation results stored in (n) points from the device specified by (d) are all on (1), SM704 turns on.
Operand Bit Word Double word Indirect
specification
Constant Others
X, Y, M, L,
SM, F, B, SB,
FX, FY
J\ T, ST, C, D, W,
SD, SW, FD, R,
ZR, RD
U\G, J\,
U3E\(H)G
Z LT, LST,
LC
LZ K, H E $
(s1)
(s2)
(d)
(n)
Instruction symbol (ladder, FBD/LD) Condition Result
BKCMP=(P)(_U), BKCMP_EQ(P)(_U) (s1)=(s2) On (1)
BKCMP<>(P)(_U), BKCMP_NE(P)(_U) (s1)(s2)
BKCMP>(P)(_U), BKCMP_GT(P)(_U) (s1)>(s2)
BKCMP<=(P)(_U), BKCMP_LE(P)(_U) (s1)(s2)
BKCMP<(P)(_U), BKCMP_LT(P)(_U) (s1)<(s2)
BKCMP>=(P)(_U), BKCMP_GE(P)(_U) (s1)(s2)
BKCMP=(P)(_U), BKCMP_EQ(P)(_U) (s1)(s2) Off (0)
BKCMP<>(P)(_U), BKCMP_NE(P)(_U) (s1)=(s2)
BKCMP>(P)(_U), BKCMP_GT(P)(_U) (s1)(s2)
BKCMP<=(P)(_U), BKCMP_LE(P)(_U) (s1)>(s2)
BKCMP<(P)(_U), BKCMP_LT(P)(_U) (s1)(s2)
BKCMP>=(P)(_U), BKCMP_GE(P)(_U) (s1)<(s2)
Error code
(SD0)
Description
2821H The device ranges starting from the ones specified by (s1) and (d) are overlapping.
The device ranges starting from the ones specified by (s2) and (d) are overlapping.
>
OFF
ON
OFF
ON
1234 (BIN)
5678 (BIN)
5000 (BIN)
7777 (BIN)
4321 (BIN)
(n)
(n) (n)
5321 (BIN)
3399 (BIN)
5678 (BIN)
6543 (BIN)
1200 (BIN)
(0)
(1)
(0)
(1)
ON
(1)
(s1)
(s1)+1
(s1)+(n)-2
(s1)+(n)-1
(s1)+2
(s2)
(s2)+1
(s2)+(n)-2
(s2)+(n)-1
(s2)+2
(d)
(d)+1
(d)+(n)-2
(d)+(n)-1
(d)+2
=
ON
OFF
ON
OFF
32000 (BIN)
(n) (n)
32000 (BIN)
4321 (BIN)
32000 (BIN)
1234 (BIN)
5678 (BIN)
(1)
(0)
(1)
(0)
OFF
(0)
(s1)
(s2)
(s2)+1
(s2)+(n)-2
(s2)+(n)-1
(s2)+2
(d)
(d)+1
(d)+(n)-2
(d)+(n)-1
(d)+2