Bit Shift or FIFO

plcengineer

Member
Join Date
Jan 2004
Location
USA
Posts
176
I have an application with a conveyor that is running 300FPM. The conveyor has a barcode scanner that will be determine which lane product will be diverted. The scanner will give us an output for each lane, so we will get an input 1 for lane 1, input 2 for lane 2 etc... This conveyor has an encoder to track position and it is a belt conveyor to eliminate most slippage. I will be using an AB plc with a high speed counter input for the encoder. Each lane will have a pusher to push the box into the divert. Also, each lane will have a PE to detect the box.

Now, I am having trouble determining how to track the box. I have thought about building a BSL in the PLC for each product. When I detect a box for lane 1, I could put a one in the BSL and start rotating the BSL with the pulse from the HSC, like I:0.0. This would be the A+ pulse from the incremental encoder. If my BSL was the length of the conveyor, I could test to see where the "1" bit was located in front of the PE for divert. If the bit position was in the right position and I saw the trailing edge of the PE, I could divert.

Also, I was thinking about some type of scaling the pulses to inches.

I was thinking about using a FIFO but I am not really sure how to tackle this. Does anyone have any specifics on how to do this. It seems pretty simple but I just can't envision how it will work.

Thanks,
 
Hi, I did something simular about 5 years ago but using a Mitsubishi A series PLC, I used a function that shifts words (can be very large & did not seem to increase scan time a great deal & had an added complication of downloading the barcode from a scada to each lane) i.e. code 156 would be for lane 10 & so on so any lane could be any code.
as an encoder would probably be to fine I used a proximity detecting a flag on the drive, used an interrupt to get the pulse & divided it then used this to shift the data, then compared the data memories in the shift with the downloaded info, this does not have to be a big shift register as photocells on each lane will detect the box & divert it at the correct time i.e. if there are 20 lanes & the max number of boxes on the total length of conveyor is say 50, then you would only need 50 16 bit memory areas, you could use a range of registers corresponding to the lane position i.e. if the start of the shift reg is n7:0 then lane 1 would correspond to N7:5 to 7 so comparing these with either a fixed value (1) in your case + the box detect PE would fire the divert.
As for shift reg it would be easy to build your own, on a oneshot move N7:49 to n7:50, then n7:48 to 49 & so on... this could be done by indirect addressing in a loop, every pulse read from conveyor px put 49 into n7:100, 50 into n7:101 then in loop move data n7:[n7:100] to n7:[n7:101], test for 0 in n7:100 if not decrement n7:100 & 101 & loop back
can't quite remember if AB plc's have word shift (well at least as big as you would require). so the above will work, just be aware of the bigger the shift required may increase your scantime above the set watchdog.
 
Thanks.. I think the AB has bit shifts called BSL AND BSR and the word shift is FFL and FFU. In regards to the encoder, could i use the pulse I:0.0 from the encoder to do the shift? This address is from the high speed counter input for the A+ of the encoder. Would it be better to shift the bits with the BSL or do a word shift?
 
Which way would work???

Now, I am having trouble determining how to track the box. I have thought about building a BSL in the PLC for each product. When I detect a box for lane 1, I could put a one in the BSL and start rotating the BSL with the pulse from the HSC, like I:0.0. This would be the A+ pulse from the incremental encoder. If my BSL was the length of the conveyor, I could test to see where the "1" bit was located in front of the PE for divert. If the bit position was in the right position and I saw the trailing edge of the PE, I could divert.

Also, I was thinking about some type of scaling the pulses to inches.
 
Plcengineer,

I reccommend the BSL for your application. The BSL function is designed for exactly this purpose. The FFL is designed to track words, or groups of data, where you only need to track the position of a package, requiring only 1 bit (not 16 bits) to represent each possible position on the conveyor. Yes, use the photoeye to insert a bit into a BSL for each diverter position. Note that each BSL can have 256 words x 16 bits, or 4096 positions. If you need more than this, you can "roll over" into another new B (binary) word file.

You do not need to "scale" the pulses inside the PLC, but in order to figure out what bit will be ON at each divert gate, you will need to know the ratio of pulses to inches. You could find the distance from the photo detector by trial and error, but I have found from experience that (on long conveyors)it is faster to physically measure the distance, convert the inches to encoder pulses, then inside the PLC program, using a XIC contact for the Binary bit, look for that bit position (or in the vicinity of that bit).
 
Last edited:
I have to agree about the BSL. Now, let me see if I have this down. For example, if the scanner gives me a 1 for lane 1 divert, I could setup a BSL for this product. At the point that I see the transition from the scanner for a 1, I start rotating that bit with the I:0/0 high speed counter input. This would simulate the package going down the conveyor to the divert. Once I see the bit within a range plus I see the PE for divert, then I could divert the product.

To test this, I could put a box on the conveyor in front of the scanner, load a one in the BSL, then jog the conveyor until the box ends up near the PE. This will allow me to see where the box is in relation to the bits..

Does this sound correct????
 
Yes, I agree with everything, except in my case I did not have to use the HSC. I used a standard input for the photoswitch detectors. It seems it would be fast enough for 300 fpm.
 
300 FPM isn't extremely fast. I doubt you'd need a high speed interrupt or counter.

I personally like th Photoeye, it's almost always better to sense an object then expect an object.

Marc
 
CroCop,

Yes, for long conveyors, it is usually necessary to use a position photoswitch along with the BSL. For example, PhotoSwitch #1 detects a package to be routed and inserts a "1" into a Bit Shift Register. Then at a diversion gate location, another PhotoSwitch #2 starts a Counter, looking for the package when the Bit Shift Register becomes equal to the (Calculated Position minus 10). The Counter is also incremented by the conveyor encoder, so that speed variations of the conveyor are nullified. The Counter Done bit then triggers a Diversion Gate solenoid. This method allows error free operation even with encoder tracking error, conveyor speed fluctuations, transfer across two conveyors, and conveyor belt stretching.
 
question
plcengineer said:
Can I use the high speed counter pulse to rotate the BSL? The line will be moving 300FPM
How many pulses per inch will the encoder be delivering?

What else, if anything, will the processor be responsible for besides product tracking?
 
Last edited:
My approach would be to create a bit shift for each divert lane. Make the length of each BSL equal to the pulse count from the scanner to their dedicated divert. The .UL bit of the BSL can then trigger the divert. I would also recommend placing a series of bits into the shift register for each package to represent the physical length of the package (use a photocell at the scanner).

The bit shift instructions (BSL & BSR) will track position. The FIFO instructions (FFL & FFU) will track sequence. You could use either, but, if someone manually removes or adds a package to the conveyor downstream of the scanner, the FIFO system will get permanently out of sync until you reset it, whereas the shift register system will push a phantom package (removed) or convey to reject (added).
 
FIFO's are very good if each package needs to be assigned information with it..

0 = Push
1 = Wrong barcode
2 = Missing barcode

etc

But the BSL should be fine for this. If you are using a 4096 count encoder, you can probably divide down the pulses to give you your positions on the conveyor. I don't know what the product is but as long as there's a gap between them for the pusher I'm sure the position doesn't need to be that accurate..

:)
 
I do this style of sortation on our new line with ten divert lanes using FIFO stacks. If a box passes the scanner and needs to go to lane one, we move a one down the FIFO stack. Same with 2-10. If you look at the integer file for the stack you set up, you'll see 1s and 3s and 7s all "moving" nicely down the stack.

I've already done the logic obviously, so I could help out if you need. I won't write it ALL for you but I'll be glad to offer assistance.
 

Similar Topics

Hi All. I have a very specific question about tracking using an encoder and bitshift register. We would like to use a Compact or Control Logix PLC...
Replies
40
Views
1,708
Hello. I've been using the answers in this forum for a while now, so thank you. Usually I can find the answer I'm looking for with a basic...
Replies
8
Views
748
Hi, I need some help write a PLC instruction. I am using Proficy Machine Edition 6.5. Our indexing rotating table has 3 nests that are equally...
Replies
15
Views
3,953
Good morning (EST), I am trying to implement the code below in on an S7-1200. It's barely half a dozen instructions, but I am stuck; I have not...
Replies
26
Views
5,648
I have a program I need to work out for a client and I'm having trouble figuring out the correct logic to do it. Let me see if I can explain it...
Replies
27
Views
6,464
Back
Top Bottom