Omron CJ - INSTRUCTIONS REFERENCE MANUAL 07-2009 Reference Manual page 655

Programmable controllers
Hide thumbs Also See for CJ - INSTRUCTIONS REFERENCE MANUAL 07-2009:
Table of Contents

Advertisement

3. Instructions
Operand Specifications
Word addresses
Area
CIO
WR
HR
AR
C
S1
OK
OK
OK
OK
S2
D1
D2
---
---
---
---
Flags
Name
Error Flag
Equals Flag
Carry Flag
Function
The number of records specified by C starting from the record specified by S1 are searched for the data
specified by S2 and S2+1. If a record that matches the search conditions is found, the Equals Flag will
turn ON, the record number of the matching record will be output to D1 and the matching record data
will be output starting from D1+1. If outputting to an index register is specified in C+3, the PLC memory
address of the first word of the matching record is output to the specified index register. When this
happens, the Equals Flag is turned ON. If more than one matching record is found, the record closest to
the first record that is searched will be output.
If a matching record is not found, nothing will be output starting from D1 (the previous values will be
maintained).
The search is performed by the method specified in C+3. There are two search methods.
• Linear Search
For a linear search, the records are searched in order from the specified first record. Linear searching
is used when the search data has not been sorted. If a matching record is found before the maximum
number of records specified in C is searched, the Carry Flag will be turned ON. (This is to indicate
that there are records that were not searched.)
• Split Search (Ascending or Descending)
If the records that are being searched have been sorted in ascending or descending order, a split
search can be used to reduce the instruction execution time.
Precautions
• If the records being searched have not been sorted in ascending or descending order when a split
search is specified, the results of the search will not be accurate.
• A split search cannot be specified if using search end data has been enabled. If using search end
data is enabled, a linear search will be performed even if a split search is specified.
618
Indirect DM/EM
@DM
T
C
DM
EM
@EM
OK
OK
OK
OK
OK
---
---
---
---
---
Label
ER
• ON when the record length in C+1 is not between 2 and 1,024, inclusive.
• ON when the number of records specified in C times the record length in C+1 is greater than
32,768.
• ON when the number of records specified in C times the record length in C+1 is 0.
• ON when the search data offset in C+2 is greater than two less than the record length in C+1.
• OFF in all other cases.
=
• ON when the search data is found.
• OFF when the search data is not found.
CY
Linear Search
• ON when a matching record is found before the final record and before the condition for the set-
ting to end the search is met.
• OFF when the search is completed through the final record or until the condition for the setting to
end the search is met.
Split Search
• Always OFF.
addresses
Con-
stants
*DM
DR
*EM
---
OK
---
OK
---
Operation
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Registers
Flags
Pulse
bits
Indirect
IR
TK
CF
using IR
---
OK
---
---
OK
---
TR
bits
---
---

Advertisement

Table of Contents
loading

Table of Contents