Compactlogix Shift Register Question

LumberJack818

Member
Join Date
Dec 2006
Location
New Jersey
Posts
13
Currently I have a vision system inspection feeding a shift register in a Compactlogix. Right now the vision system determines that part is good or bad and the shift register tracks the part and diverts it accordingly.

What I've been asked to do is upon a particular failure dump all the parts from the vision system to the diverter. The number of parts being dumped varies depending on the length of part being produced. I know I can write a series of move statements to fill the shift register based on all the possible length options but I was curious to know if anyone had an idea on a shorter more elegant way to do this? Like is there a quick way to convert a decimal number into a series of bits. Like if the number of parts to be dumped was 25 then the last 25 positions of the shift register become 1's.

This is kinda more of an academic question, I know that I can do this with a bunch of move statements. But I am thinking that there must be a better way.

Thank you for any advice you can offer.
 
I've used a similar instance recently. What you can use is the XpY function.

1. Add 1 to the value that you are working with to 'Tag_A'
2. XpY (2, 'Tag_A', 'Tag_B')
3. Subtract 1 from 'Tag_B'

This will turn the value into the corresponding quantity of bits. You can now use this as either a masked move or a BTD bit field distribute to place them into the corresponding register location.
 
How about Fill? (FLL)

FLL
Source - 1
Destination - ShiftRegister[0]
Length - DumpLength

If you need the other end of the shift register:
SUB DumpLength from ShiftRegisterLength to StartPosition
Make FLL Destination - ShiftRegister[StartPosition]
 
Last edited:
If 0=Pass and 1=Fail and the number of parts is known according to Length. Then Instead of Modifying the Shift Register just SET the Diverter Bit to 1 for Count. When the Counter is Done Unlatch.
 

Similar Topics

Good Morning , I'm developing a Shift Register Program for a conveyor system. I begin the Shift Register on a conveyor that is roughly 128...
Replies
14
Views
3,584
Hello all, and thank you in advance for any assistance you may be able to provide! This is my first post, so if I need to reformat or change...
Replies
0
Views
30
We are trying to poll data coming from a PLC for remote monitoring we have the IP address of the PLC and the default port number and the path is...
Replies
25
Views
423
Hi everyone, this is my first time trying to setup encoder counts and track the traveled distance and speed i am using L27ERM QBFC1B processor...
Replies
12
Views
334
I have a device that is currently connected to a UR 10 robot through a UR Cap and I would like to connect the device to an Allen Bradley...
Replies
3
Views
316
Back
Top Bottom