Omron CJ - INSTRUCTIONS REFERENCE MANUAL 07-2009 Reference Manual page 305

Programmable controllers
Hide thumbs Also See for CJ - INSTRUCTIONS REFERENCE MANUAL 07-2009:
Table of Contents

Advertisement

3. Instructions
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
(inclusive 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.
Lower limit value
B
Comparison
B+2
data
S
B+28
B+30
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.
0.00
D100
D200
D300
S: D100
268
1 when inside the range
Inside the range?
0 when outside of range
Upper limit value
R
B+1
0
B+3
1
B+29
14
B+31
15
D200
D202
D204
D206
D208
D210
D212
D214
D216
D218
D220
D222
D224
D226
D228
D230
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
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
corresponding bit of R.
to
D201
to
D203
to
D205
to
D207
to
D209
to
D211
to
D213
to
D215
to
D217
to
D219
to
D221
to
D223
to
D225
to
D227
to
D229
to
D231
CS/CJ/NSJ Series Instructions Reference Manual (W474)
S
B+31).
R: D300

Advertisement

Table of Contents
loading

Table of Contents