Sign in to follow this  
Followers 0
Guest Guest

500 different product-numbers programming

4 posts in this topic

Hello, I am using a PLC-5/25 processor on a DH+ network from Allen Bradley for a product-machine. I have about 500 product numbers. One product number have 6 numbers example: 123456 in Ascii using N7:0(lsd=2 and msd=1), N7:1 (lsd=4 and msd=3), N7:2 (lsd=6 and MSD=5). When a product comes on a position of the machine, a database send the productnumber to this 3 words. Now I want to do an action for each different product-number on this position programming a rung with 3 Equal-blocks. When the Equal-blocks for a product-number is true then a bit is set. This means that I must programming 500 rungs for the used product-numbers!!!!!! Is there another possibility? Who knows? Greetings, mulderm

Share this post


Link to post
Share on other sites
We had a similar problem using SLC500. Many product numbers represented by a format which could hold many thousands times the possible products. (If the numbers had been only 0-499 then it would have been a lot easier. We set up 'N' files which could hold up to the required number (in this case that would be 500) product numbers. N10 and N11 held the top number N12 and N13 the next etc. We allowed indexing across file boundaries. When the product code arrived (from a barcode scanner in our case) a pseudo for/next loop started comparing the received codes to those stored in the N files looking for a match. I say a 'pseudo' for/next loop as I only compared 10 each scan trying to keep the scan time down for the rest of the process. The longer time to find a match had no effect on the process as the scanned item was waiting for other machine processes to complete anyway. Once a match was found we had an index, the Xth entry in the tables. This index could be then used to look up parameters in yet other tables for processing this case. It worked just fine. It took a lot of thinking but it worked out in the end. So there was actually only one compare rung coded. If the processing time is really critical then set up the match tables in numerical order and do a binary lookup. Then it could be done in one scan with little effect on the scan time. I've never coded that on a PLC. It could be fun.

Share this post


Link to post
Share on other sites
If your product codes are sorted in order then I would do some kind of binary search. A binary search is where you have 3 pointers, one points to the bottom of the list, one to the top and one to the middle. Because your data is sorted in order, if the item stored at the middle pointer is greater than what you are searching for you can then consider your table to be from the bottom to the middle and keep repeating this until you find what you are looking for. This following would require a maximum of 9 loops to locate the correct value and the value in N7:5 would point to it. This is just a quick example and has a couple of bugs in it. If you don't understand then there are many people on here who can either help further (myself included) or offer alternatives. It goes a little like this ... >Initilaise the table from 0 to 499, >Calculate the middle >If the table is the minimum size (i.e. last check) then goto the end >If the number is less than that in the middle of the table then resize the table and jump back >If the number is greater than that in the middle of the table then resize the table and jump back >the end: check to see if the value is found. Example (N10 contains the 3 word values): (why the thumbnail image is over 1Mb and the actual GIF is 72Kb no-one knows - sorry, not my fault) Edited by Spedley

Share this post


Link to post
Share on other sites
Thank you guy´s for the information. I´ve got a idea to do this. In Access I set 500 records with the product-numbers. For each product-number I give a integer-number (bit-patron). These integer-number will I send to the PLC/5 (example N12:0) to do an action. First when the product-number arrived in the PLC I must start a macro in Access who choose the right integer-number for this product-number. How to write this macro in VBA, must try. Any suggestion? mulderm

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