Omron CJ - REFERENCE MANUAL 02-2010 Reference Manual page 618

Table of Contents

Advertisement

3. Instructions
Flags
Name
Error Flag
Equal Flag
Related Auxiliary Area Words and Bits
Name
IR0 Output for Background
Execution
DR0 Output for Background
Execution
Equals Flag for Background
Execution
ER/AER Flag for Background
Execution
Function
SRCH(181) searches the range of memory
from R1 to R1+W-1 for words that contain the
comparison data (Cd). If a match is found,
SRCH(181) writes the PLC memory address
of the word to IR0 and turns the Equals Flag
ON.
(If there are two or more matches, just the
address of the first word containing the
comparison data is written to IR0.)
When bit 15 of C+1 has been set to 1,
SRCH(181) writes the number of matches to
DR0. When bit 15 of C+1 is 0, DR0 is left
unchanged.
Hint
• SRCH(181) searches table data that contains one word in each record. For searching data that
contains more than one word per record, use DIM(631), SETR(635), GETR(636), FOR(512)-
NEXT(513), or BREAK(514) together with an Index Register (IR).
• SRCH(181) can be processed in the background. Refer to the SYSMAC CS/CJ/NSJ Series PLC
Programming Manual (W394) or the CJ2 CPU Unit Software Operation Manual (W473) for details.
Precautions
• The status of the Equals Flag can be checked immediately after execution to determine whether or
not there was a match.
• If no match is found, the contents of IR0 and DR0 are left unchanged.
• If background execution is enabled in the PLC Setup, the PLC memory address of the first word
containing a match will be output to Auxiliary Area words A595 and A596 instead of IR0.
• If background execution is enabled in the PLC Setup and control word C+1 is set to output the total
number of matches to DR0 (C+1 = 8000 hex), the total number of matches will be output to Auxiliary
Area word A597 instead of DR0.
582
Label
ER
• ON if the content of C is not within the specified range of 0001 through FFFF.
• ON if the Communications Port Enabled Flag for the communications port number specified as the
Com Port number for Background Execution is OFF when background processing is specified.
• OFF in all other cases.
=
• ON if one or more of the words in the search range contain the comparison data.
• OFF in all other cases.
Address
A595 and A596
When an index register is specified as the output for an instruction processed in the background, A595
and A596 receive the output instead of IR0.
(A595 contains the rightmost digits, and A596 contains the leftmost digits.)
A597
When a data register is specified as the output for an instruction processed in the background, A597
receives the output instead of DR0.
A598.01
This flag is turned ON if matching data is found for a SRCH(181) instruction executed in the
background.
A395.10
This flag is turned ON if an error or illegal access occurs during background execution.
Operation
Operation
PC memory
address
R1
R1+(W–1)
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Search
Cd
W
Match
IR0

Advertisement

Table of Contents
loading

Table of Contents