Sign in to follow this  
Followers 0
sb234

Twido - Data Table Search

3 posts in this topic

I'm new to Twido programming and need to find out how to access data within a table. In this case, I have a table of 100 records with 10 fields in each record. So, for example I would store this data in consecutive registers between %MW1000-%MW1999. The most recent record data would be in %MW1000:10, the next would be %MW1010:10, etc. Through an operator interface, the operator may select to view any of the 100 records. My question is how do I write that as an instruction? Its easy enough to know the 5th record is in %MW1040:10. All of the examples I've found show instructions where specific registers are addressed. Obviously, here the head address will always be variable based on the requested record number. I usually program Mitsubishi processors which have an index register just for this situation. Thanks for any input!

Share this post


Link to post
Share on other sites
Hi, The problem with this plc is you can not use an index for a table of words. To be clear you can not write : %MW0:10:=%MW1000[%MW10]:10 with %MW10 as the index. A solution will be to use one index to acess the first word of the table according the operator selection and then use anothers indexes calculated with the first one. Imagine %MW10 is the index selected by the operator, this index will vary from 0 to 10, 20, 30 etc. then the index of the second word will be index 1 + 1 and so on. I'm going to try to write it to be more clear. %MW0 to %MW9 is the table to visualize the records %MW10 to %MW19 are the indexes %MW10 is modified by the operator, it must be a multiple of 10 starting from 0 Calculation of the indexes %MW11:=%MW10+1 %MW12:=%MW10+2 ..... %MW19:=%MW10+9 Vizualisation of the records in a table %MW0:=%MW1000[%MW1] %MW1:=%MW1001[%MW2] ...... %MW9:=%MW1009[%MW19] It's complicated to explain it in english but it's not so hard when you have understood the basis of the method. JC

Share this post


Link to post
Share on other sites
JC, Thanks for the help. I'll try what you have suggested. It looks like the brackets are used as an indexing device, but only one register can be done at a time rather than an entire record or multiple registers. Thanks again, Steve

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0