Nj-Series Instructions Reference Manual (W502 - Omron NJ501-1500 Reference Manual

Machine automation controller nj-series
Hide thumbs Also See for NJ501-1500:
Table of Contents

Advertisement

Function
The ArySearch instruction searches Size elements of one-dimensional array to search In[] for elements
with the same value as search key Key. The search starts from In[0].
The values of search result Out, found element number InOutPos, and number found Num are as fol-
lows:
Element with
same value as
Key
Exists.
Does not exist.
The following example is for when Size is UINT#6 and Key is INT#5555.
The input parameter that is passed to In[] is abc[2], so the search starts from abc[2].
LD
abc[2]
UINT#6
INT#5555
def
The lowest element number that
contains same value as Key is 3.
In[0]=abc[2]
In[1]=abc[3]
In[2]=abc[4]
Size=UINT#6
In[3]=abc[5]
In[4]=abc[6]
In[5]=abc[7]
Precautions for Correct Use
• Always use a one-dimensional array for In[].
• Make sure that Key has the same data type as the elements of In[].
• If the value of Size is 0, the values of Out and Num are 0. The value of InOutPos does not change.
• When Key is an enumeration, always use a variable for the input parameter to pass to Key. A building
error will occur if a constant is passed.
• An error occurs in the following cases. ENO will be FALSE, and Out, Num, and InOutPos will not
change.
• Size exceeds the array area of In[].
• In[] or Key is STRING data and it does not end in a NULL character.
• In[] is not a one-dimensional array.

NJ-series Instructions Reference Manual (W502)

Out
InOutPos
TRUE
Lowest element number that con-
tains the same value as Key
FALSE
Does not change.
ArySearch
EN
ENO
In
ghi
Size
Num
jkl
Key
InOutPos
def
Not searched.
Key=INT#5555
5555
2345
5555
5555
4567
1234
9876
5555
Not searched.
Number of elements with
same value as Key
0
ST
ghi:=ArySearch(abc[2], UINT#6, INT#5555, def, jkl);
TRUE
Out=ghi
InOutPos=def
UINT#3
UINT#2
Num=jkl
2 Instruction Descriptions
Num
2
2-315

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Nj501-1300Nj501-1400

Table of Contents