Although Mispeld has a solution. I set this up with an Array of DINT's instead of bits. It uses two FSC instructions to find location and length. Anyway, I banged it out today so I figured I'd post it. Good luck with your project. It's an exported subroutine.
I noticed one thing in the routine the Gap Counter Preset is set to 20 and it should be 19 since I made the Gap Length Array 20. If counter counts to 20 it will fault processor. So just make sure you set your Gap Counter to Gap Length Array size minus 1.
I'm sure your close to figuring out your solution, I am just asking this for my own understanding. You are creating logic that reflects where the part is at on the conveyor. If you know exactly how many seconds it takes for the part to travel from one end to the next, could you not create a simple timer and use the .acc value to move the image on the screen horizontally relative to the time through the HMI software?
I have a process where a part is spinning on a fixed enclosure, and on my HMI I am using the exact degrees from the PLC to locate the part on the HMI screen, so the operator knows exactly what direction the part is facing at all times through the screen.
This is my way of doing it, maybe I misunderstood what you are trying to accomplish. Or maybe you are looking for more accuracy. I just ask for my own understanding.