273
3. Instructions
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Comparison Instructions
3
BCMP2
BCMP2
Applicable Program Areas
Operands
Instruction Mnemonic Variations
Function
code
Function
EXPANDED BLOCK
COMPARE
BCMP2 @BCMP2 502
Compares the source data to up to 256 ranges
(defined by 256 lower limits and 256 upper limits)
and turns ON the corresponding bit in the result
word when the source data is within a range.
Symbol
BCMP
Area
Function block
definitions
Block program areas Step program areas Subroutines Interrupt tasks
SFC action or
transition programs
Usage OK OK OK OK OK OK
Operand Description Data type Size
S Source data WORD 1
B First word of block WORD Variable
R Result word WORD Variable
B: First word of block R: First result word
Each bit of each R word contains the result of a comparison between S and
one of the ranges defined the comparison block. The maximum number of
result words is 16, i.e., m equals 0 to 15.
BCMP2(502)
S
B
R
S: Source data
B: First word of block
R: First result word
B+31
B+32
B+33
B+34
B+35
B+36
B+37
B+38
B+2N+1
B+2(N+1)
B
B+1
B+2
B+3
B+4
B+5
B+6
07815
Range 15 value A
Range 15 value B
Range 16 value A
Range 16 value B
Range 17 value A
Range 17 value B
Range 18 value A
Range 18 value B
Range N value A
Range N value B
Range 0 value A
Range 0 value B
Range 1 value A
Range 1 value B
Range 2 value A
Range 2 value B
Comparison block
Word
N: 00 to FF hex
(0 to 255)
00 hex Last range "N"
Range 0
Range 1
Range 2
Range 15
Range 16
Range 17
Range 18
Range
data
Range N
15 014
Comparison result for S
and range 16m + 14
Comparison result for S
and range 16m + n
Comparison result for
and range 16m
Comparison result for S
and range 16m + 15
R+m
n