Eric Nelson
Lifetime Supporting Member + Moderator
Finished an install today of a fairly simple 2 camera inspection system on an old carousel assembly machine. I used a shift register on one of the cameras to reject failed product downstream. I've done many similar projects in the past with no problems. In this application, the machine speed is >300 cycles per minute, so I figured I'd use an interrupt.
The inspection location is determined by an Electrocam PLS on the existing machine. This is my interrupt input. In the image below, the green ladder is a subroutine (called unconditionally), and the pink is the interrupt routine.
The camera trigger output functioned fine, as well as the reject solenoid output. The issue I had was with the shift register. Even though my Camera 2 "PASS" Latch (C18) was ON, a '1' would never make it into the shift register. All shift register bits remained at zero.
My 'solution' was to move the shift register instruction (and C18 RESET) from the interrupt to the subroutine. Since the subroutine runs continuously, I used a one-shot of the interrupt input as the CLOCK input, and also to RESET the "PASS" Latch (C18). This worked as expected, and the machine is currently running fine...
Brief explanation of the screenshot below:
-Eric
The inspection location is determined by an Electrocam PLS on the existing machine. This is my interrupt input. In the image below, the green ladder is a subroutine (called unconditionally), and the pink is the interrupt routine.
The camera trigger output functioned fine, as well as the reject solenoid output. The issue I had was with the shift register. Even though my Camera 2 "PASS" Latch (C18) was ON, a '1' would never make it into the shift register. All shift register bits remained at zero.
My 'solution' was to move the shift register instruction (and C18 RESET) from the interrupt to the subroutine. Since the subroutine runs continuously, I used a one-shot of the interrupt input as the CLOCK input, and also to RESET the "PASS" Latch (C18). This worked as expected, and the machine is currently running fine...
Brief explanation of the screenshot below:
When the interrupt occurs, it SETS the camera trigger output (Y3). This output gets RESET (in the subroutine) after timer T2 expires. This is how long the output stays on to trigger an inspection by the camera (20ms in this case).
After the camera completes it's inspection, it turns on an input if the inspection passes. In the MAIN program (not shown), this input turns on C8 for one scan (the "PASS" one-shot). This in turn SETS the "PASS" latch (C18).
The next time the interrupt occurs, the status of the "PASS" latch (C18) SHOULD get loaded into the shift register, and the shift register should advance. I used an 'always on' bit for the CLOCK, since the interrupt only occurs for that one scan. Immediately after the shift occurs, I RESET this "PASS" latch.
Additionally, when an interrupt occurs, it checks the status of the product at the reject location (24 stations downstream). If it is OFF, it SETS the Reject Solenoid output (Y6). This output gets RESET (in the subroutine) after timer T3 expires. This is how long the output stays on to reject the failed product (150ms in this case).
I am just wondering why the shift register inside the interrupt didn't work as I had expected... After the camera completes it's inspection, it turns on an input if the inspection passes. In the MAIN program (not shown), this input turns on C8 for one scan (the "PASS" one-shot). This in turn SETS the "PASS" latch (C18).
The next time the interrupt occurs, the status of the "PASS" latch (C18) SHOULD get loaded into the shift register, and the shift register should advance. I used an 'always on' bit for the CLOCK, since the interrupt only occurs for that one scan. Immediately after the shift occurs, I RESET this "PASS" latch.
Additionally, when an interrupt occurs, it checks the status of the product at the reject location (24 stations downstream). If it is OFF, it SETS the Reject Solenoid output (Y6). This output gets RESET (in the subroutine) after timer T3 expires. This is how long the output stays on to reject the failed product (150ms in this case).
-Eric