Shift Register Inside an Interrupt - 'Click' PLC...

Eric Nelson

Lifetime Supporting Member + Moderator
Join Date
Apr 2002
Location
Randolph, NJ
Posts
4,346
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... :D

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... :unsure:

🍻

-Eric

clickinterrupt.jpg
 
I would say that the shift register doesn't work is because the clock input is always high. To do it that way you would need to call the interrupt at twice the rate and alternate the clock input leg, but that's probably not a good solution.

Instead, why not create you own "manual" shift register? A simple copy instruction set to "block copy" with inputs C201-C231 and outputs C202-232. Then copy C18 into C201. This is a simple shift register and will execute everytime it is scanned (instead of having a clock input like the SR).
 
I would say that the shift register doesn't work is because the clock input is always high. To do it that way you would need to call the interrupt at twice the rate and alternate the clock input leg, but that's probably not a good solution.
Good point about the CLOCK input. It probably needs to see a transition from OFF to ON to execute. Even though the interrupt isn't active, it still 'knows' that the CLOCK input did not change state. I'll bet if I had simply used the input that triggers the interrupt as the CLOCK, instead of the ALW_ON bit, it would have worked.

Instead, why not create you own "manual" shift register? A simple copy instruction set to "block copy" with inputs C201-C231 and outputs C202-232. Then copy C18 into C201. This is a simple shift register and will execute everytime it is scanned (instead of having a clock input like the SR).
Yes, that would be another good solution.

Thanks for the feedback!... :site:

🍻

-Eric
 

Similar Topics

I am attempting to reject a bottle If the label fails. The rejection works fine at normal line speed but at low speed the rejector fires (air...
Replies
35
Views
1,150
Hi guys, I am pretty new when it comes to programming. I am working with CX-Programmer and I am having a problem where I have a sensor on my...
Replies
6
Views
689
Hi all, i have a very slow indexing machine where we are looking to make everything as bulletproof as possible, money is not much of a factor...
Replies
12
Views
3,068
Good morning (EST), I am trying to implement the code below in on an S7-1200. It's barely half a dozen instructions, but I am stuck; I have not...
Replies
26
Views
5,677
Hi everyone I am completely new to using shift registers and am a bit stuck, my shift register works as should, it is for an overhead conveyor...
Replies
55
Views
15,625
Back
Top Bottom