Bit Shifts
If find that the trickiest thing to program can be that transition bit.
As Terry said, it needs to go from OFF-to-ON for the BSL to activate and move everyone over one. But it needs to go from ON-to-OFF in order that the BSL will recognize the next OFF-to-ON.
In that respect, it works like a counter, except instead of incrementing a number, it shoves bits over by one.
They are most frequently used to represent a physical object in the PLC that exists in the real world. Let's say it's bottles on a conveyor line, and you've got a "checking station" at one location, and a "reject station" at a different one. If the "checking station" detects a problem, it sets a bit in the shift register. When the bit shifts down to the position represented by the "reject station", the reject station ejects the bottle. Sounds simple, and I've used a shift register for exactly that application.
Buy if you are using a photoeye to generate the "shift" pulse, it had better see a gap between
every bottle, or you'll reject the wrong one.
Sometimes you use a timer generate the "shift" pulse. But if the bottles slip on the conveyor, the reject station might miss. The problem becomes even trickier if you've got a variable speed drive controlling the conveyor. Adjust the time between "shift" pulses based on the speed? Doesn't work well.
A few things that may be AB specific:
In a bit shift, you can use multiple consecutive words (B or N), and there is no "word-boundary" between the bits. (in a 2-word (e.g., 32-bit ==> R6:0.Len=32) "bit bucket" as Terry calls it, using File #N7:0, N7:1/0 is the bit that N7:0/15 would be shifted into (I always forget if this is considered "Left" or "Right" however).
For this reason, I prefer to use B-type registers for the File, and set up RSlogix to display Binary files as /Bit, instead of Word/Bit. I'll set up a register specifically for the shift register. This way, I can see that B17/22 is the 22nd position in the bit bucket (I prefer calling it a Bit String, since it acts like a string of beads)
(I thing it was Ron B who "discovered" the following
Even if you only use 8 bits in a shift register, the PLC will actually shift every bit in the word. If you use other bits in that word in your logic, they will be affected by the shifting.