question: do you have any type of REAL-WORLD input signal that tells you WHEN you have moved from one position to another? ... maybe a proximity sensor, a limit switch, etc. ...
if yes, then tell us the address (I:____) of that input ...
big idea: we need to tell the PLC WHERE it is (physical position) in order to shift the status bits ... for example: suppose that each time the machine advances a notch, switch A closes when we reach a new physical position ...
type up your sequence of operation something like this: put in ALL of the details ... remember that the PLC is "STUPID" ... it has to be told everything ...
machine reaches position 1 ...
switch A closes ...
pulse trigger to camera ...
camera responds "good" or "fail" ...
write a status bit to ONE for "fail" – or ZERO for "good" ...
move machine from position 1 ...
switch A opens ...
move machine to position 2 ...
switch A closes ...
advance the "fail/good" status bit information one notch ...
move machine from position 2 ...
switch A opens ...
move machine to position 3 ...
switch A closes ...
advance the "fail/good" status bit information one notch ...
move machine from position 3 ...
switch A opens ...
move machine to position 4 ...
switch A closes ...
advance the "fail/good" status bit information one notch ...
if the status of the "fail/good" bit equals ONE, then reject the part ...
once you've got that "what-happens-when" step done, then look at the BSL (Bit Shift Left) instruction ... see if that helps ...
SUGGESTION: experiment (read "PLAY") with the BSL logic in a simple "dummy" program BEFORE you try to insert it into your actual program ...
you should be able to manually toggle the "fail/good" status OFF or ON ...
you should be able to manually advance the machine – and the status of the bit – through the PLC's memory locations ...
you should be able to SEE the status of the bit take the appropriate action when it finally reaches the "reject" position ...
DISCLAIMER: all of this is written based on what little we understand about the operation of your machinery ... if it doesn't make sense, then I strongly suggest that you tell us more about how the machinery functions ...
PS Edit ... I see that Bernie is online now ... if he tells you something different, then go with his way ... I'm out of here for awhile ...