Table Find - Siemens SIMATIC S7-200 System Manual

Programmable controller
Hide thumbs Also See for SIMATIC S7-200:
Table of Contents

Advertisement

Table Find

The Table Find instruction (FND) searches a table for data
that matches certain 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.
Error conditions that set ENO = 0
H 0006 (indirect address)
H 0091 (operand out of range)
Table 6-71
Valid Operands for the Table Find Instruction
Inputs/Outputs
Data Types
TBL
WORD
PTN
INT
INDX
WORD
CMD
BYTE
Tip
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 Figure 6-36.
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.
Table format for ATT, LIFO, and FIFO
VW200
0006
VW202
0006
VW204
xxxx
VW206
xxxx
VW208
xxxx
VW210
xxxx
VW212
xxxx
VW214
xxxx
Figure 6-36
Different Table Formats between the Table Find Instruction and the ATT, LIFO, and FIFO
Instructions
Operands
IW, QW, VW, MW, SMW, T, C, LW, *VD, *LD, *AC
IW, QW, VW, MW, SMW, SW, T, C, LW, AC, AIW, *VD, *LD, *AC, Constant
IW, QW, VW, MW, SMW, SW, T, C, LW, AC, *VD, *LD, *AC
(Constant) 1: Equal (=), 2: Not Equal (<>), 3: Less Than (<),
4: Greater Than (>)
TL (max. no. of entries)
EC (entry count)
d0 (data 0)
d1 (data 1)
d2 (data 2)
d3 (data 3)
d4 (data 4)
d5 (data 5)
S7-200 Instruction Set
Table format for TBL_FIND
VW202
0006
EC (entry count)
d0 (data 0)
VW204
xxxx
VW206
xxxx
d1 (data 1)
VW208
xxxx
d2 (data 2)
VW210
xxxx
d3 (data 3)
VW212
xxxx
d4 (data 4)
VW214
xxxx
d5 (data 5)
Chapter 6
193

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents