Sign in to follow this  
Followers 0
Jetboy47

CJ1W-CT021 Part Tracking

9 posts in this topic

I am scanning a barcode of a product on a conveyor. I have a trigger sensor that activates the scanner and also gives me an input to the PLC at the same time. I am getting a read back about one second later wether the barcode is good or not to my DM address, the data to the DM is working ok. And two seconds after that I must reject the part if the barcode is bad. My problem is I have never used a highspeed counter, and I am not sure how to track each part, and keep track of them up to the reject station. I have a CJ1G-CPU42 with a CT021 counter and a 100 pulse/rev enocder. Each index works out to approximately 139 pulses but this is not exact and can vary. Could someone please give me some advise on how to shift the data along where I can flag each part if the barcode read was bad and then reject it on a moving the moving conveyor while other parts must also be continually tracked at the same time. My boss is all over me to get this to work. Any help would be greatly appreciated!!! Thanks, Jetboy47

Share this post


Link to post
Share on other sites
I would make some kind of queue in the DM's, with counter values seen for all parts that have the first sensor, but haven't yet passed the rejection station. Add also a list of bits to that, with info if the part is ok or not. Then you'll be able to use the high speed counter as a distance measurer only (I assume a constant distance between the three stations), and can couple the "ok reading" with the correct part. If the part is defective you'll also know then to reject it. As the sensor values vary a bit, you'll have to build som tolerance (a few pulses perhaps) into the system.

Share this post


Link to post
Share on other sites
Why can;t you use the input of the encoder in the PLC to fire a shift register 139 bit long ? No need to to number comparisons... quite simple really... that is how tarcking is usually done..

Share this post


Link to post
Share on other sites
Because he can't be totally sure that the defective parts pass after exactly 69,5 pulses? Also, presumably, the reason he uses a counter unit in the first place is that a counter pulse is longer It's a fully possible solution though. Just use two shift registers (one for marking where the parts are, one for marking where the defective ones are), consider the PLC cycle times, and mark some of the positions before and after as defective ones as well.

Share this post


Link to post
Share on other sites
Is this time consistant? I'm not sure I fully understand the process you describe?

Share this post


Link to post
Share on other sites
The index is not consistant, so I have no way to use one rev/index. That would make things a easier for me but it is not an option. Parts are on a conveyor, and when they are flowing fine the index is about 139 pulses, but there are lags when the product is not there. I must be able to track each part starting from the trigger signal and inbetween that point and the reject station I must receive an ok (valid UPC read) from a PC which is sending a "1" to a DM in my PLC. That "1=valid read" or "0=no read" flag must match up with the product that was scanned so I know wether to reject it or not. Edited by Jetboy47

Share this post


Link to post
Share on other sites
Jays info on counters & HS interupts on this site is very usefull. Look at my problems with HS counting with CJ1M CPU22 http://forums.mrplc.com/index.php?showtopic=6062&hl= my last bit of code (counter 1 test 4) sets up a high speed encoder driven counter and fires off interupt routines when positions set in DM address's are met. These positions are easy to manipulate and you could just chuck a value in the first address, set the counter to 0 and look for only the first pos each time if you wanted. I assume that you are planning to move the conveyor 'n' counts once scanned, then if the part is present and the PC flags a reject you can kick it off. If the part is not present (IE gaps were not even etc) then will you just move 'n' counts again or look for the part with a sensor? It may well be easier to just count the parts at the reject station with a sensor and when the duff one gets there to bin it - just using a normal counter or index register. (count them at the scan station and at the reject station and use the difference to calc how may parts till the duff one). I would probably set a counter to inc @ the scan and dec @ the reject point, the count PV then always = the qty twixt the two points (assuming none were present @ startup).

Share this post


Link to post
Share on other sites
Hi Try this Sample code. Will do exactly what you want. The counter is simulated with a timed interrupt, but there is an FB input that will take your encoder counter instead.

Share this post


Link to post
Share on other sites
Just wanted to thank you all for your support. I used TERdON's suggestion of using the counter for doing the math for position of the product and having a shift register for marking each part with a vaild read or a invalid read. It is working well now. Thanks for al your replies, the more info and options you guys give the easier it is for the programmer to figure out what will wok the best for that application. Cheers! Jetboy47
1 person likes this

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