7-60
7.5 Data Processing Instructions
7.5.1 16-/32-bit data search
SER, DSER
DSER(P)
(1) Searches n points from the device specified for
in units of 32 bits (2 n points in units of
16 bits) regarding 32-bit data of the device specified for
as a keyword. Then, the number
of matches with the keyword is stored to the device specified for
[1], and the relative value
from
to the first matched device number is stored to the device specified for
.
(2) No processing is performed if n is 0 or a negative value.
(3) If no matches are found in the search, the device specified for
becomes 0.
If the data to be searched using the SER(P) or DSER(P) instruction is sorted in
the ascending order, searches can be accelerated by the use of the binary search
method, which is activated by turning SM702 *
1
ON. However, correct search
results are not obtained if SM702 is turned ON when the data to be searched are
not sorted in the ascending order.
*1: SM702 is the special relay for setting the search method.
• SM702 OFF: Sequential search method (linear search method) (Comparison with the search data starts
from the beginning of the data to be searched.)
• SM702 ON: Binary search method (Obtains the center value of the sorted array and decides if the
obtained value is larger or smaller than the search value, then, chooses the area for search between the
larger and smaller value divisions. By repeating this process, the area for search is narrowed down.)
O
peration Error
In any of the following cases, an operation error occurs, the error flag (SM0) is turned ON, and
the corresponding error code is stored to SD0.
• The n points from the device
exceeds the specified device range. (Error code: 4101)
• The device specified for
exceeds the corresponding device range. (For Universal
model QCPU only)
(Error code: 4101)
s
2
s
1
d
s
2
d
d
s
2
d
s
2
s
2
s
2
s
2
1
2
Pos
i
t
i
on
of
match
N
um
b
er
of
matches
[1]
+3,
+5,
+(
n
-4)
+(
n
-2)
S
earch
range
(2
n
po
i
nts
)
S
earch
resu
l
ts
M
atch
d
ata
S
tart
num
b
er
to
b
e
searche
d
5678901
S
earch
d
ata
+1,
+2
+4
+(
n
-3),
+(
n
-1),
+1,
-1
5678901
5678901
0
5678901
123456
5678901
s
1
s
1
s
2
s
2
s
2
s
2
s
2
R
e
l
at
i
ve
va
l
ue
[0]
d
Data
to
b
e
searche
d
500
400
600
200
300
100
700
Data
to
b
e
searche
d
500
400
600
200
300
100
700
Data
to
b
e
searche
d
500
400
600
200
300
100
700
500
S
earch
d
ata
S
earch
or
d
er
S
earch
range
C
ompare
d wi
th
the
search
d
ata
S
earch
range
C
ompare
d wi
th
the
search
d
ata
S
earch
range
C
ompare
d wi
th
the
search
d
ata
s
2
d
Summary of Contents for MELSEC Q Series
Page 1: ...Structured Programming Manual Mitsubishi Programmable Controller QCPU Common Instructions ...
Page 2: ......
Page 14: ...A 12 MEMO ...
Page 340: ...6 178 MEMO MTR ...
Page 708: ...7 368 MEMO ...
Page 776: ...8 68 MEMO ...
Page 796: ...9 20 MEMO ...
Page 804: ...App 8 MEMO ...
Page 812: ...Index 8 MEMO ...
Page 815: ......