![background image](http://html1.mh-extra.com/html/omron/sysmac-cs1d-cpu/sysmac-cs1d-cpu_reference-manual_742268365.webp)
326
Comparison Instructions
Section 3-7
Setting Ranges
The values A and B for each range will determine how the comparison oper-
ates depending on which value is larger, as shown below.
Example
When B+1
≤
B+2
If B+1
≤
S
≤
B+2, then bit 0 of R will turn ON,
If B+3
≤
S
≤
B+4, then bit 1 of R will turn ON,
If S < B+5 and B+6 < S, then bit 2 of R will turn OFF, and
If S < B+7 and B+8 < S, then bit 3 of R will turn OFF.
When B+1
>
B+2
If S
≤
B+2 and B+1
≤
S, then bit 0 of R will turn ON,
If S
≤
B+4 and B+3
≤
S, then bit 1 of R will turn ON,
If B+6
<
S
<
B+5, then bit 2 of R will turn OFF, and
If B+8
<
S
<
B+7, then bit 3 of R will turn OFF.
Results Storage Location
The results are output to corresponding bits in word R. If there are more than
16 comparison ranges, consecutive words following R will be used.The maxi-
mum number of result words is 16, i.e., m equals 0 to 15.
Flags
Example
When CIO 000000 is ON in the following example, BCMP2(502) compares
the content of CIO 0010 with the 24 ranges defined in D00200 through
D00247 (N = 17 hex = 23 decimal, i.e., 24 ranges) and turns ON the corre-
sponding bits in CIO 0100 and CIO 0101 when S is within the range and OFF
when S is not within the range. For example, if the source data in CIO 0010 is
in the range defined by D00201 and D00202, then bit 00 of CIO 0100 is
turned ON and if it in not in the range, then bit 00 of CIO 0100 is turned OFF.
Likewise, the source data in CIO 0010 is compared to the ranges defined by
D00203 and D00204, D00247 and D00248, and the other words in the com-
Value A
Value B
Comparison range
Value B
Comparison
range
· If Value A
≤
Value B
Then, Value A
≤
Comparison range
≤
Value B
· If Value A
>
Value B
Then, Comparison range
≤
Value B and Value A
≤
Comparison range
Comparison
range
Value A
15
0
14
Comparison result for
S and range 15m + 14
Comparison result for
S and range 15m + n
Comparison result for
S and range 15m
Comparison result for
S and range 15m + 15
R+m
n
Name
Label
Operation
Error Flag
ER
OFF
Summary of Contents for SYSMAC CS1D-CPU**
Page 3: ...iv...
Page 29: ...xxx...
Page 185: ...146 List of Instructions by Function Code Section 2 4...
Page 1389: ...1350 CJ series Instruction Execution Times and Number of Steps Section 4 2...
Page 1390: ...1351 Appendix A ASCII Code Table ASCII SP Four leftmost bits Four rightmost bits...
Page 1391: ...1352 ASCII Code Table Appendix A...