Program instructions
7.16 Table
S7-200 SMART
System Manual, V2.3, 07/2017, A5E03822230-AF
373
7.16.4
Table find
LAD / FBD
STL
Description
FND= TBL, PTN,
INDX
FND<> TBL, PTN,
INDX
FND< TBL, PTN,
INDX
FND> TBL, PTN,
INDX
The Table Find instruction searches a table for data that matches your search
criteria. The Table Find instruction searches the table TBL, starting with the
table entry INDX, for the data value or pattern PTN that matches the search
criteria defined by CMD. The command parameter CMD is given a numeric
value of 1 to 4 that corresponds to =, <>, <, and >, respectively.
If a match is found, the INDX points to the matching entry in the table. To find
the next matching entry, the INDX must be incremented before invoking the
table find instruction again. If a match is not found, the INDX has a value equal
to the entry count.
A table can have up to 100 data entries. The data entries (area to be searched)
are numbered from 0 to a maximum value of 99.
Non-fatal errors with ENO = 0
SM bits affected
•
0006H Indirect address
•
0091H Operand out of range
None
Input / output
Data type
Operand
TBL
WORD
IW, QW, VW, MW, SMW, SW, T, C, LW, *VD, *LD, *AC
PTN
INT
IW, QW, VW, MW, SMW, SW, T, C, LW, AC, AIW, *VD, *LD, *AC, Constant
INDX
WORD
IW, QW, VW, MW, SMW, SW, T, C, LW, AC, *VD, *LD, *AC
CMD
BYTE
Constant:
•
1 = Equal (=)
•
2 = Not Equal (<>)
•
3 = Less Than (<)
•
4 = Greater Than (>)
Note
When you use the table find instruction with tables generated with the Add-to-table, Last-in-
first-out, and First-in-first-out instructions, the entry count and the data entries correspond
directly. The maximum-number-of-entries word required for the Add-to-table, Last-in-first-out,
or First-in-first-out instructions is not required by the Table find instruction. See the following
figure.
Consequently, you should set the TBL operand of a Find instruction to one-word address
(two bytes) higher than the TBL operand of a corresponding the Add-to-table, Last-in-first-
out, or First-in-first-out instruction.