... I am self taught and have never had the need to use shift registers and I am unsure as to how to write the code as I am only familiar with ladder logic.
Any help with code will be appreciated.
0) Bit shifts may be a black box to you now, but once you understand what they do, you will probably be able to implement the necessary code; it is not very complex in the end, but it requires understanding a few aspects of PLCs. Some of the rest of this may already be in your toolbox.
1) PLC programming is primarily about time, and the scan cycle is the clock. It is far more useful to ask yourself when something is happening than what is happening. To understand I suggest watching this video series.
https://www.youtube.com/watch?v=T3tnXu-Eywc&list=PLB1ACAF773A15BFB1
2) PLC programs implement nothing more than a
model of a real-world process using bits. Understanding how bits model (represent) that process is crucial to PLC programming, because the only thing you can do in a PLC program is change bits and move bits' values around; see (1) above.
2.1) Do you understand
2.1.1) what a discrete bit (input, or output, or memory) is by itself, and what its possible values are?
2.1.2) what a bit is in an aggregate entity like an integer, and what its possible values are, and those values represent in the aggregate?
2.1.3) what a bit is in an array of integers or bits of a bit-shift array, and what those bits' values
model (represent) in the real-world process, and what those bits' location' model?
2.1.4) what does shifting the bit values in an array of integers or bits of a bit-shift array
model in the actual process?
3) Do you have the Mitsubishi programming manual?
3.1) If yes, do you understand how the bit-shift instructions work, and how they move bits' values around, and how that models your process?
3.1) If you do not understand how the Mitsubishi bit-shift instructions work, try a better manual from another brand e.g. here.
https://literature.rockwellautomati...re/documents/rm/1756-rm003_-en-p.pdf#page=505
3.1.1) I have found that the various brands of PLCs' implementations of the various sets of instructions are more or less the same. Some IDEs and ladder syntax rules are better, some are worse, but all are doing more or less the same thing.
4) Note that a bit shift instruction shifts bits
only on the rising edge of its input rung.
5) Does Mitsubishi have a PLC emulator where you can play with the bit-shift instruction to understand its behavior?s
5.1) If not, try another brand e.g. RSLogix Micro Starter Lite and RSEmulate 500 are freebies that that you can experiment to understand bit shifting, then you should be able to transfer that knowledge back to Mitsubishi-land.
5.1.1) Note that, despite 3.1.1 above, instructions may not operate identically across brands, so after you understand what a bit shift instruction does from another brand, go back to the Mistubishi manual and with that new knowledge re-read the description of the Mistubishi bit shift instruction, to see if (i) you can now understand the Mitsubishi description, and (ii) if there are any differences in how the Mitsubishi bit shift instruction works.
6) Search this forum for keywords bit shift, conveyor, and reject station, to find threads about processes similar to yours.
6.1) Read carefully any posts by @parky.
6.2) Look at the various programs posted and ask any questions you have about them here.