Description
Original instructions
Function description
This function block searches a source table for an entered bit pattern. It increments the directory in the source table in each released cycle and checks whether the displayed Array element matches the defined pattern or not.
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
Representation in LD
Appearance:
Representation in IL
Representation:
CAL SRCH_Instance (TRIG:=StartsSearch, CONT:=ContinueSearch,
    SRC:=SourceTable, PATTERN:=BitPatternForSearch,
    INDEX:=FindingPlace, FOUND=>FoundPattern)
Representation in ST
Representation:
SRCH_Instance (TRIG:=StartsSearch, CONT:=ContinueSearch,
    SRC:=SourceTable, PATTERN:=BitPatternForSearch,
    INDEX:=FindingPlace, FOUND=>FoundPattern) ;
Parameter description
Description of input parameters:
Parameter
Data type
Description
TRIG
TRIG detects the rising edge and starts the search for the next element in the table.
CONT
BOOL
CONT defines whether to continue the search or to resume it at the beginning of the table.
1 = The search will be continued with the next rising edge of TRIG.
0 = The search position is reset to the beginning of the table with the next rising edge of TRIG and the first element of the table will be compared to the pattern.
SRC
ANY should be a field (array) of type INT, DINT, UINT, UDINT or REAL e.g. ARRAY[0..X] OF INT
Source table
PATTERN
PATTERN is the bit pattern to be searched for.
Note: The length of the bit pattern to be searched for is always derived from the length of the data type at the input PATTERN; the length of the Array element is not considered. To enable correct work methods, make sure that the data type of PATTERN is identical to that of the array to be searched for.
Description of input / output parameters:
Parameter
Data type
Description
INDEX
UINT
INDEX displays the Array index of the last search process. (This means that when the pattern is found, the INDEX parameter will indicate where the pattern was found in the table). The value of the variables at the input can be changed with the application to change the search position in the table.
Note: INDEX always displays the Array index to which the last comparison was applied. It will always begin counting at 1 for the first Array element, regardless of the actual Array limits that were defined in the data editor. INDEX always counts ascending, even if the index is greater than the number of Array elements.
Description of output parameters:
Parameter
Data type
Description
FOUND
BOOL
1 = pattern found