About This File
Products arrive on conveyor irregularly pitched. Conveyor is equipped with an encoder or maybe a proxy looking at the sprocket.
This program captures the position and then multiple FB calls can be made to give an output at a distance from the input point maybe at a label inspction point or reject unit.
The Shift register readout FB can be called as many times as necessary.
The encoder can be connected to a high-speed counter meaning that the PLC scan need not 'see' every number i.e the encoder counter can be asynchronous.
I've simulated this in this program by incrementing the 'encoder' with a timed interrupt.
Adjacent to the product position stack is a product status stack so data can be written in at any point too e.g. I'm in front of the label detect sensor - if it's on then I can enter a '1' (say) into the stack. As the status is kept in a Word then upto 16 devices can write into the stack. Subsequent writes are ORed with existing data.
This can be achieved with FIFO but this method is more efficient as data is not actually moved just pointers to the data.