49
CS/CJ/NSJ Series Instructions Reference Manual (W474)
2. Summary of Instructions
2-2 Instruction Functions
2
2-2-5 Comparison Instructions
DOUBLE
SIGNED BINARY
COMPARE
CPSL
115
Output
Required
264
MULTIPLE COM-
PARE
MCMP
@MCMP
019
Output
Required
267
TABLE COM-
PARE
TCMP
@TCMP
085
Output
Required
269
UNSIGNED
BLOCK COM-
PARE
BCMP
@BCMP
068
Output
Required
271
EXPANDED
BLOCK COM-
PARE
BCMP2
@BCMP2
502
(CS1-H, CJ1-H, or
CS1D CPU Unit
Ver. 2.0 or later
and CJ2 CPU
Units only)
CJ1M CPU Unit
(Pre-Ver. 2.0 or
Unit Ver. 2.0 or
later)
Compares the source data to up to 256 ranges (defined by upper and
lower limits) and turns ON the corresponding bit in the result word when
the source data is within a range.
Output
Required
273
Instruction
Mnemonic
Code
Symbol/Operand Function Location
Execution
condition
Page
CPSL(115)
S
1
S
2
S1: Comparison
data 1
S
2: Comparison
data 2
S1+1
S2+1
Compares two double signed binary values (constants and/or the
contents of specified words) and outputs the result to the Arithmetic
Flags in the Auxiliary Area.
Signed binary
comparison
Arithmetic Flags
(>, >=, =, <=, <, <>)
MCMP(019)
S
1
S
2
R
S
1: 1st word of
set 1
S
2: 1st word of
set 2
R: Result word
R
ompares
consecut
ve wor
sw
t
anot
er
consecut
ve wor
s
and turns ON the corresponding bit in the result word where the
contents of the words are not equal.
Comparison
0: Words
are equal.
1: Words
aren't
equal.
TCMP(085)
S
T
R
S: Source data
T: 1st word of
table
R:R
l
w
r
R
Compares the source data to the contents of 16 words and turns
ON the corresponding bit in the result word when the contents are
equal.
1: Data are
equal.
0: Data aren't
equal.
Comparison
BCMP(068)
S
T
R
S: Source data
T: 1st word of
table
R:R
l
w
r
T+3
1
0
14
15
T+29
T+31
T+1
T+2
T+28
T+30
T
S
R
to
to
to
to
Ranges
Upper limit
Compares the source data to 16 ranges (defined by 16 lower limits
and 16 upper limits) and turns ON the corresponding bit in the result
word when the source data is within the range.
1: In range
0: Not in range
Lower limit
Source data
BCMP2(502)
S
T
R
S: Source data
T: 1st word of
block
R: Result word
T+1
T+3
T+2N+1
S
T
T+2
T+4
T+2N+2
0
1
D
N
D+15 max.
Bit
1: In range
0: Not in range
Source data
Range 0 A
Range 1 A
Range N A
n=255 max.
Range 0 B
Range 1 B
Range N B
Note: A can be less than
or equal to B or
reater the B.