RSLogix 5000 Structure Shift

take the "bare bones" rung that I showed in Post #3 and "dress it up" as follows:

put an XIC at the far left side of the rung ... address the XIC to a new BOOL tag named Go_Now ...

put an OTU at the far right side of the rung ... address the OTU to the same BOOL tag named Go_Now ...

then put some sample data values into your array ...

then manually TOGGLE the Go_Now tag and see what happens ...

the basic "ratchet" code that I sent you in Post #3 should do what you want ... specifically, every time that you manually toggle the Go_Now tag ON, then the data should march one step – and the tag should automatically turn itself right back OFF again ...

I didn't put any "go now" conditions on the rung since I didn't know when you want it to "go" ... but the simple "experimental" method that I just detailed should make the data march just like your spreadsheet shows ...

if it doesn't, post your ACD file instead of a screen shot ... maybe there's something wrong with the way you're "triggering" the rung ...

once you get the data marching correctly (with the manual toggle/trigger), then you can work more on the "when should it go" piece of the puzzle ...

(and yes, my dinner was excellent) ...
 
Last edited:
Ok, Hanx

I will try it, but I think there is something wrong with the Length in the first copy instruction

regards

Bernd
 
well, I remember saying that you might have to adjust the length to fit your specific requirements ... the idea is that USUALLY the length is set to ONE LESS THAN the number of locations you're using - because one of the locations is going to be "discarded" anyway ...

let us know what you come up with ...
 
Ladies,

Hanx for your help. Here you can see what I use now. Its exactly what Ron said in Post 3.

The only problem with this solution is, that it uses twice that much memory than my solution. It might be a problem, because I am using Compact Logix and not Control Logix. Because its not a servo application with more than 8 Axis.

And if the Array is a structure with may 1000 Protocols ?!?!? HMmmm.

But it works fine.

Hanx again

regards

Bernd
 
Analysing your posted ladder, I offer the following comments:-

1. You say your arrays are 350 elements long - Yet you are only using elements 1 thru' 349. Is _4300_Array[0] being used at all?

2. The Length specifier for the second COP instruction cannot work, unless the data-type of _4300_Array is DINT. Why are you manipulating the length of the COP? Or is this a typo?

Is _4300_Array just a DINT ARRAY tag, or a User-Defined Tag ?? You cannot use tag of a user-defined data-type here (which you imply is the case, because of thread title ...Structure Shift).

If you use a tag - it must be a DINT tag (is what the Help says, but you can use an INT, but less efficient).

3. If you are NOT using _4300_Array[0], then, to save a little memory, make that your "Empty" data, your 3rd COP Source would then be _4300_Array[0], and you don't need the _4300_EmptyArray.

4. If you do need _4300_EmptyArray, then why is it an Array tag (unless used elsewhere).

5. To save another small bit of memory, 1st COP Destination, and 2nd COP Source could be _4300_TempArray[0], and that array need be only 349 elements long.

6. Is there anything stopping you re-structuring your approach, COP the data DOWN the array, and place your new value in at _4300_Array[349], as has been suggested? Obviously this depends on what else is using the data, how many edits are involved?
 
Last edited:
Yes you are right !
in the second cop instruction should be 349 and then it works with structure. But after all this discussion, I change the array to DINT, so it was easier. I dont know how this indirect adress comes there.

So change it to DINT Number and it works fine with all kinds of datatype that a cop instruction allows you.

regards

Bernd
 
Hi, I have a question about the ratchet type operation on post #3. I have tried it out with an array of 5 elements and works fine. Then tried it the same way inside an aoi using 20 elements but cannot get it to work. Temp Array [0] will just go straight through to the end every time
Thanks,
Dec
 
Couldn't you use the ripple going from top to bottom in the same way without using the temporary array. Simply copy array[1] to array[2] with a length of 79 and then move the new value into array[1]??

now then ... if you have no problems with a "backwards" (bottom to top) flow of data through the array, you can save the memory required for the "temporary" array I mentioned above (and some extra COPy time) by using the technique suggested by my distinguished colleague, Alan Case ... I usually call this a "RIPPLE" effect ...

the rung shown below should be helpful in setting it up ... pay careful attention to the [2] and [1] values in the COP command ... (most people get these backwards when they first try this technique) ...

good luck with your project ...
 
Couldn't you use the ripple going from top to bottom in the same way without using the temporary array. Simply copy array[1] to array[2] with a length of 79 and then move the new value into array[1]??

no – that's a simple idea – but try it out and you'll find that unfortunately it won't work ...

for an example, suppose that array[1] contains the value 1 ... array[2] contains the value 2 ... and so on ...

when the Copy operation begins, it will copy the value 1 from array[1] into array[2] ... so array[2] now contains the value 1 ...

next the Copy operation will copy the value 1 from array[2] into array[3] ... so array[3] now contains the value 1 ...

and so on ...

so when the Copy has finally finished, ALL of the array locations will end up being filled with whatever value happened to be stored in array[1] at the beginning ...

so ...

the RIPPLE uses less memory – but it has to run "backwards" ...

the RATCHET runs "forwards" - but it uses more memory ...
 
Thank You All!

I was in high school when this thread started, but I'm finding it exceptionally useful in 2019. (y)🍻
 
Method

I know this is an old thread but I found this to be the easiest way to do the copy/shift. Using 3 copy instructions and a temporary dint array of the same size of your arrray.
In this example:
You copy from your dint array to the temporary dint array at the lenght of the array-1. (COP DintArray[0] to TempDintArray[0] length of array-1, then COP TempDintArray[0] to DintArray[1]length of array-1 then you update the array with the new value you want to add so COP ValueDint to DintArray[0] at a length of 1) See picture of my use for it.

That will shift it down and update the newest value at position [0]


Disregard my post lol just noticed I was a page behind lol someone already posted the soluitions

TempCopy.jpg
 
if I understand your question correctly (and I think that I do) then I suggest that you try the "ratchet" type operation shown below ... you'll need to set up a "temporary" storage array to make it work – but I've got a hunch this will do what you want ... you might also have to play around with the "length" settings too – but based on how I understand your question, this is pretty close to what you're asking for ... basically I'm just wondering why you specified "starting" at ARRAY[1] - instead of "starting" at ARRAY[0] ... is that a typographical mistake? - or is that really what you want to do? ... either way, you should be able to make this work - but try it out a few times with some sample data to make sure it's doing what you want ...

also ... note that due to the way the ControlLogix scan sequence is set up, there is a chance that some of the data within the array may be changed/altered/updated PART WAY THROUGH THE SHIFTING OPERATION ... if this could have an adverse effect on your system, then read up on the CPS command and consider using it instead of the (somewhat faster) COP ...

Thank you very much for this post. I understand I can do a million moves, but this is exactly what I was looking for! If you can explain the application where FFL and FFU that would be helpful to me too since I have been trying to do this same thing but with those instructions.
 
Thank you very much for this post. I understand I can do a million moves, but this is exactly what I was looking for! If you can explain the application where FFL and FFU that would be helpful to me too since I have been trying to do this same thing but with those instructions.

I did something like that a few years ago, using FFL and FFU.

I needed to store different values from every item produced, so I made an UDT with the proprieties I wanted to store. I named my UDT "Data_Log".
FFL_001.jpg

Then I "grabbed" the needed data every time I have a new finished product and stored that on a variable (Bobine_Grab) with my UDT (Data_Log) as Data Type. This would be your new element that need to be inserted on your array.
FFL_002.jpg

Now, this is how I used the FFL/FFU instructions (prior to that day I had never used the instructions, so maybe there's another way, but this worked for me).

FFL_003.jpg
I start with FFU to "Unload" the array and make place for new data. FFU takes the last position and dumps it on a variable (Similar to Bobine_Grab, I created Bobine_Data_Dump for this). Once FFL "dumps" the last position, it shift the array content one position down.

Then, FFL takes the data stored at Bobine_Grab and puts it on the next empty place at the array (Position 0 as FFU just shifted down the whole array).

The Array Bobine_Data[0] is using my UDT as Data Type.

Then I display the last 20 products at the PanelView.
FFL_004.jpg

TL;DR
FFU.FIFO = Your working array.
FFU.Dest = A place to dump your oldest array value.
FFU.Control = Instruction Control (use the same for your FFL instruction).

FFL.Source = New Data you need to store (at the next empty registre).
FFL.FIFO = Your working array.
FFL.Control = Instruction Control (use the same for your FFU instruction).
 

Similar Topics

Hi all, In my Rslogix 5000 project, I use FAL instruction(File Arithmetic and Logic),Dest and expression are INT data type, When use res...
Replies
12
Views
12,646
Hello all, I have a question in regards to RSlogix 5000. I am having issues with the program force closing when I try to make online edits. We...
Replies
0
Views
95
Greetings ... someone sent me a request for some student handsouts that I developed ... turns out that I had this hosted on my business website...
Replies
0
Views
110
Thank you for any and all responses/help. I have an RSLogix 5000 v20 and a Cognex In-Sight v5.9 spreadsheet (8502P). I can not figure out how to...
Replies
0
Views
101
Hi All, I've been pulling my hair out trying to fix this for a few days and need some advice. I have V19.01, v20.05, V21, V24, V30, V31, V32...
Replies
5
Views
352
Back
Top Bottom