table find

Amr Hassan

Member
Join Date
May 2005
Posts
340
iam using the tbl-find function from the ti library in the s7

but it is not working properly


CALL "TBL_FIND"
SRC :=DB14.DBX0.0
PATRN :=DB14.DBX40.0
CMD :=B#16#1
E_TYPE :=B#16#4
RET_VAL:=MW0
INDX :=MW2



as i understand that the first cell of the table (containing the table length) is db14.dbw0 and the cell containg the value i am looking for is db14.dbw40

where i am i wrong?
 
Last edited:
patience is a virtue they say.

SRC :=DB14.DBX0.0
PATRN :=DB14.DBX40.0

should be

SRC :=P#DB14.DBX0.0
PATRN :=P#DB14.DBX40.0
 
Dear peter
When i write P#db14.dbx0.0 the editor turns it to db14.dbx0.0
i noticed that this does not happen if db14 is not existing
 
INDX parameter is IN_OUT type. As input it's an index at whitch block starts to search for the pattern, as output it provides index to element containing pattern. If you want to search for the first element with pattern you should write 0 to MW2 before call of "TBL_FIND".
 
Last edited:
Are the datawords you are pointing to in the correct format?

P#DB14.DBX40.0, as type = 4, then you are searching WORD's. The first word DBW40, should be the length of search, your search should then be started at DBW42!!
For example

DB14.DBW40 = 3 (search length = 3)

DB14.DBW42, 44 and 46 are searched and they should all be set up as a WORD.


P#DB14.DBX0.0 points to the pattern, again as type = 4 (WORD) then DBW0 should be a WORD containing the pattern you are searching for.
 
Hi Amr Hassan

Here are a few pics that may help you.
The point is that you have to assign symbols to the variables in the search DB.
edit: And the search DB must have a symbol too, like "findtbl" in my example.

When i enter P#DB1.DBX0.0, STEP7 exchanges it with "Findtbl".Findme

FC86_2.GIF


FC86_1.GIF
 
Last edited:
Jespers solution of course means you must put a value of 1 in MW100 before you start to make sure you jump over index0, which is the serach pattern.



Back to check-in desks from another thread, this is how I did the search for an empty window, reflecting the check-in desk position in the equivalent to MW100.
 
Peter, you are right, but I figure that it is better to put the search pattern in the start rather than in the middle like Amr Hassan's example.
Of course, the search pattern can be any where else than in the same DB.
 
Dear all



Thanks for your help

When i loaded 0 to the index before calling the function as advised

it worked properly



u are great help
 

Similar Topics

Out of interest, I'd like some thoughts on what would be considered best practice with regards to a 2-position turntable control scheme (see...
Replies
17
Views
1,177
I've asked this before but I still couldn't make it work. I just can't envision a solution. Local RTU has a screen to set a handful of...
Replies
18
Views
1,578
Since upgrading to V6.2 12.24 SP12 24-21 the M221 PLC is no longer recognised by the HMI. The screen still works but it does not talk with the...
Replies
3
Views
1,018
Hello, Does anyone know if there is a portable version of RSLinx Lite (even an old one)? I am wondering as I am trying to put together some tools...
Replies
0
Views
694
Hi. I'm working with a SLC 5/05 but I have no experience with it. I've been tasked with trying to figure out if it is possible to directly modify...
Replies
6
Views
1,083
Back
Top Bottom