Omron CP1E-NA@@D@-@ Computer Hardware User Manual


 
2 Instructions
2-104
CP1E CPU Unit Instructions Reference Manual(W483)
Function
BCMP(068) compares the source data (S) to the 16 ranges defined by pairs of lower and upper limit
values in B through B+31. The first word in each pair (B+2n) provides the lower limit and the second
word (B+2n+1) provides the upper limit of range n (n = 0 to 15). If S is within any of these ranges (inclu-
sive of the upper and lower limits), the corresponding bit in R is turned ON. If S is out of any these
ranges, the corresponding bit in R is turned OFF.
Sample program
When CIO 0.00 is ON in the following example, BCMP(068) compares the content of D100 with the 16
ranges defined in D200 through D231 and turns ON the corresponding bits in D300 when S is within the
range or OFF when S is not within the range.
For example, bit 00 of R is turned ON if S is
within the first range (B S B+1), bit 01 of R is
turned ON if S is within the second range (B+2
S B+3), ..., and bit 15 of R is turned ON if S
is within the fifteenth range (B+30 S B+31).
All other bits in R are turned OFF.
Note An error will not occur if the lower limit is
greater than the upper limit, but 0 (not
within the range) will be output to the cor-
responding bit of R.
B
B+2
B+28
B+30
S
B+1
B+3
B+29
B+31
0
1
14
15
R
Inside the range?
Lower limit value Upper limit value
1 when inside the range
0 when outside of range
Comparison
data
D201
D203
D205
D207
D209
D211
D213
D215
D217
D219
D221
D223
D225
D227
D229
D231
to
to
to
to
to
to
to
to
to
to
to
to
to
to
to
to
S:D100 03A0 D200
D202
D204
D206
D208
D210
D212
D214
D216
D218
D220
D222
D224
D226
D228
D230
R: D300
BCMP
D100
D200
D300
0.00
0400
0390
0400
0400
0400
0400
0390
0400
0500
03A0
0390
0400
0400
0000
0000
0000
0
0
1
0
1
1
0
0
1
1
0
0
1
0
0
0
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
03A1
0000
0000
03A1
03A0
0000
0000
03A1
0000
0000
0000
03A1
0000
0000
03A1
0000