Table Find Table

Inputs/Outputs Operands Data Types
TBL VW, IW, QW, MW, SW, SMW, LW, T, C, *VD, *AC, *LD WORD
PTN VW, IW, QW, MW, SW, SMW, AIW, LW, T, C, AC, Constant, *VD, *AC, *LD INT
INDX VW, IW, QW, MW, SW, SMW, LW, T, C, AC, *VD, *AC, *LD WORD
CMD (LAD, FBD) Constant BYTE

Memory Ranges ENO Errors Instruction Support for S7-200 CPUs SIMATIC/International Mnemonics

The Table Find instruction searches the table (TBL), starting with the table entry specified by INDX, for the data value (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 may have up to 100 entries. The data entries (area to be searched) are numbered from 0 to a maximum value of 99.

Error Conditions that Set ENO = 0:

SM4.3 (run-time), 0006 (indirect address), 0091 (operand out of range)

Note:

When you use the Find instructions with tables generated with ATT, LIFO, and FIFO instructions, the entry count and the data entries correspond directly. The maximum-number-of-entries word required for ATT, LIFO, and FIFO is not required by the Find instruction. Consequently, the TBL operand of a Find instruction is one word address (two bytes) higher than the TBL operand of a corresponding ATT, LIFO, or FIFO instruction, as shown in the table below.