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,611
Hi everyone, i have a compact logic 1769-L18 PLC and I'm using FTalk View ME for the display. I wanted to do some visualization on Grafana. At...
Replies
1
Views
75
Does anyone know what the data transfer rate for this series of CompactLogix PLC's? 1769-L24ER-QB1B to be exact. Cheers.
Replies
1
Views
80
Does this instruction calculate values during a single scan, or does it require number of scans based on element count in the array? For Example...
Replies
3
Views
100
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
6
Views
375
Back
Top Bottom