9 binary search instruction (bsrch), Program example, Outline – Yaskawa MP900 Series Machine Controller New Ladder Editor User Manual
Page 121: Format

1.6 Data Manipulation Instructions
1-111
1
Program Example
The five words beginning with MW00100 are compressed into 5 bytes beginning with
MW00200.
1.6.9 BINARY SEARCH Instruction (BSRCH)
Outline
The BSRCH instruction uses a binary search method to search the designated data (Search
Data) within the designated search range (Source). The search result (offset from the lead-
ing register number of the search range for the matching data) is stored in the designated reg-
ister (Result).
Note: 1. Before executing the BSRCH instruction, sort the data within the
search range in ascending order.
2. If there are two or more words with identical data, the first register
number that matches the data will be stored.
3. If no matching data is found, -1 will be stored.
Format
When the number of transfered
bytes is an odd number, "0" is set.
10H (Lower byte)
11H (Upper byte)
MW00200
MW00201
MW00202
12H
13H
14H
00H
10H (Lower byte)
00H (Upper byte)
11H
00H
12H
00H
13H
00H
14H
00H
MW00100
MW00101
MW00102
MW00103
MW00104
Symbol: BSRCH
Full Name: Binary Data Search
Category: MOVE
Icon: