joseph_e2
Member
Not sure it buys anything at all, just throwing it out there. I'm having a hard time reading the text on the drawing, so I just kind of winged it. If he already has a mechanism in the code that tracks the queue, then the hard part is probably done. If not I have a few further thoughts on this.
You would have to keep track of how many boxes are on the belt (a "boxes on belt" counter) so you could add the next one in the right place. Basically, if "1" is a small box and "2" is a large box, your array might look like this:
0,0,0,0,0,0,1,1,2,1,2,2,1,2,1
The brake would look at the "right" end of the array to see that it has to release, in this case, a small box. It would then trigger a "word shift right" (just making up terms here) and decrement the "boxes on belt" counter. The preceding machine would look at the "boxes on belt" counter to figure out where in the array to stick its 1 or 2 for the box it's adding to the queue.
As far as overfilling the conveyor, a simple photo-eye near the entrance end would fix that. Don't add a box to the queue unless the photo-eye is clear.
Actually, one advantage I can see is that you can use a single array instead of multiples. To use bit arrays, you would need an array for each size box that will be run. Also, the numbers here could be directly used as timer presets. Instead of "1" and "2", you could use "500" to represent 0.5s for the small box and "1200" for 1.2s for the larger box. If you change the size of the box, or add a third size, it's easy enough to update the code.
You would have to keep track of how many boxes are on the belt (a "boxes on belt" counter) so you could add the next one in the right place. Basically, if "1" is a small box and "2" is a large box, your array might look like this:
0,0,0,0,0,0,1,1,2,1,2,2,1,2,1
The brake would look at the "right" end of the array to see that it has to release, in this case, a small box. It would then trigger a "word shift right" (just making up terms here) and decrement the "boxes on belt" counter. The preceding machine would look at the "boxes on belt" counter to figure out where in the array to stick its 1 or 2 for the box it's adding to the queue.
As far as overfilling the conveyor, a simple photo-eye near the entrance end would fix that. Don't add a box to the queue unless the photo-eye is clear.
Actually, one advantage I can see is that you can use a single array instead of multiples. To use bit arrays, you would need an array for each size box that will be run. Also, the numbers here could be directly used as timer presets. Instead of "1" and "2", you could use "500" to represent 0.5s for the small box and "1200" for 1.2s for the larger box. If you change the size of the box, or add a third size, it's easy enough to update the code.