Rslogix 5000 Shift register, move 4 bits at a time

This is what was in my mind. All though when I test this, It not working..
One reason your BSL method did not work is that you used the SAME Source Bit "Input_Main_EM" for all 4 shifts. All that will do is move the same bit 4 different times. What you would need is to shift 4 consecutive bits 4 times. That will require 4 BSL instructions, each with a DIFFERENT consecuticve Source Bit address, and each BSL triggered 4 times for each of your pulses.

Or you can use the multiply-by-16 then MVM method.
 
you could use the BTD Instruction to determine if all bits in each set are true.

Now I have created a simulation picture from my HMI panel, so you can see the princippal of this hole opperation.
The green are good products and the red are bad products.

I have now 2 shift registrer, witch works perfectly.

In the third shift register, i need to count the number of good products from both shift registrer 1 and 2, when they reach a certain point in the process(the end to the left), then move the number (in this case 6) in another shift registrer, witch should have a lenght of 10.

Do you still preffer to use BTD for that action ?

.....
Maybe I should say that shift register 1, moves 4 products at a time, and so do numer 2.

shiftregister_simulation.jpg
 
if you want to count the number of bits that equal 1 in your shift register no matter where they are in the shift pattern then the brute force method would work the best.

Create a subroutine for counting bits. Then create a DINT to hold the Sum of your count. In the first rung of you count subroutine Clear the Sum value to zero. Then the next 32 rungs will be used to count bits. Logic would be like this.

Rung 0 CLR SUM
Rung 1 XIC SHIFTARRAY[3].0 ADD SUM 1 SUM
Rung 2 XIC SHIFTARRAY[3].1 ADD SUM 1 SUM
etc..

every scan you will clear the SUM value to zero and the add the bits that are true. This will give you the amount of bits true in ShiftArray[3]
 
if you want to count the number of bits that equal 1 in your shift register no matter where they are in the shift pattern then the brute force method would work the best.

Create a subroutine for counting bits. Then create a DINT to hold the Sum of your count. In the first rung of you count subroutine Clear the Sum value to zero. Then the next 32 rungs will be used to count bits. Logic would be like this.

Ok.. I did that now, and it works fantastic.
Thank you very much for all the help.

I just wanna run one last thing by you guys.

I was thinking in stead of making a FIFO, with the numbers, to the last shift register, I was planing to make an add-on intruction that i can use later, where the numbers were visible for all the positions i need.
I attached a picture so you can se, what i have in mind.

The numbers are supposed to travel down one at a time every time a new value get entered in INPUT.

The only thing with this one, is that it just replaces all the numbers with the value equal to INPUT. any idea of what might help me here ?

addon.jpg ins.PNG
 
Last edited:
Logic is solved from left to right then top to bottom. if you want to shift values manually the way you show. Then start at the end and work back to the top.

If INPUT <> INPUT OLD Then Move position 30 to 31 Then Move position 29 in 30 then 28 to 29 etc....
 
Logic is solved from left to right then top to bottom. if you want to shift values manually the way you show. Then start at the end and work back to the top.

If INPUT <> INPUT OLD Then Move position 30 to 31 Then Move position 29 in 30 then 28 to 29 etc....

Ok.. I tried a few things now.

I cant seem to det it to do what I want.
His is the code I ended up with, and as you can see, the only bit I can get to stay the same is the last one, and I kind of think that maybe I cant do it this way?

It sould be like a FIFO, but with displaying numbers, so that it is easier to debug from a distance.

ttt.jpg ttt_AOI.PNG
 
if you want to shift INT Values then use the COPy Instruction. Make an Array with length of 10 Put your INPUT Value into Array[10] then COP Array[1] into Array[0] for Length of 10. This will copy your values stored in 1-10 and paste them into 0-9. So you just shifted all values by 1. For Display from Top to Bottom then Show Position 9 at the top of your chart and position 0 at the bottom.
 
Last edited:
if you want to shift INT Values then use the COPy Instruction. Make an Array with length of 10 Put your INPUT Value into Array[10] then COP Array[1] into Array[0] for Length of 10. This will copy your values stored in 1-10 and paste them into 0-9. So you just shifted all values by 1. For Display from Top to Bottom then Show Position 9 at the top of your chart and position 0 at the bottom.

Works like a charm!!
Thankyou so much..
So.. I learn a lot of new thinks here. :)

I attached the AOI to this comment in case of other people needing this option.
 
Multiply your DINT Value by 16. This will shift the 4 bit pattern 4 positions.

That's great.

I needed to shift 8 bits from position position 8 to position 0. Using the multiplication approach made it so easy.

I have 13568 => 0011 0101 0000 0000 dividing it by 256 results 0000 0000 0011 0101 (53). Nice!
 

Similar Topics

Hello All, Please i am making a shift report in Tons in Rslogix 5000 for three shifts,morning, afternoon and night for every 8 hrs. The challenge...
Replies
2
Views
1,785
I've got three INT words in RSLogix 5000 Version 12.06. They are Sawset, Sawset1, and Sawset 3. I have three momentary pushbuttons set to assign a...
Replies
11
Views
2,136
Hallo Everybody ! I was a little confused here. I try to shift a structure with FFL What I want is to shift a structure of values from Array[2]...
Replies
28
Views
27,468
I am completely stuck on building a ladder program that requires a start button to be pressed 3 times to turn on motor 1. Then motor 2 starts...
Replies
20
Views
501
Back
Top Bottom