Omron CS1G/H-CPUxxH Instructions Manual page 294

Sysmac cs series; sysmac cj series
Hide thumbs Also See for CS1G/H-CPUxxH:
Table of Contents

Advertisement

Comparison Instructions
Flags
Example
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.
· If Value A ≤ Value B
Then, Value A ≤ Comparison range ≤ Value B
Value A
· If Value A > Value B
Then, Comparison range ≤ Value B and Value A ≤ Comparison range
Comparison
range
Value B
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.
15
14
R+m
Comparison result for
S and range 15m + 14
Comparison result for
S and range 15m + 15
Name
Label
Error Flag
ER
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
Comparison range
Value B
Comparison
range
Value A
n
0
Comparison result for
S and range 15m + n
Operation
OFF
Section 3-7
Comparison result for
S and range 15m
273

Advertisement

Table of Contents
loading

Table of Contents