Perhaps a little explanation is in order here
I wrote that up quick to post and I did forget to create the LBL loop my bad.
The new file shows it corrected. Sorry about that
First of all the ONS (One Shot) in the trigger rung
It’s just Housekeeping it insures that the file shift will only executes 1 time per trigger True. The trigger needs to reset or go false and true again to start the shift over. Otherwise it could go into runaway.
For this demo I have named the array File_Shift the number of elements is 500 (0-500) it can be anything you want any size you need
As for not using the File_Shift[0] if you look I load the Data (FS_Data) into File_shift[0] the base of the array with a True Trigger, at the same time I move 500 into FSIndex. To start the loop.
As long as FSIndex is > 0 the program will loop in Label FS_1 when FSIndex = 0 the rung will go False and the program will jump out of the loop and continue.
Inside each loop I start at the top (500), copy File_Shift[(FSIndex – 1)] to File_Shift[FSIndex]
499 copy to 500 (Move the data up 1 element in the array)
499 is moved to 500, 498 in mover to 499 all the way down to 0 is moved to 1 with each loop.
FSIndex=(FSIndex – 1) loop to LBL FS_1
The UID and UIE are optional they just prevent the data in File_Shift from getting changed while the file shift loop is running.
This method used only 1 data array so you always know which array to use in the program.
Moves the data from the array base 0 up to the top one step per trigger.
While I cannot say I have actually used this in a ControlLogix PLC I have used this same block in a Micrologix PLC with good success just a smaller array size.
I think this has advantages over the FIFL and FIFU
No Unload is needed and the load is just a simple COP or MOV command
Data can be loaded or copied in or out at any point in the array again with just a simple COP or MOV command.
If you load at index 0 then the last data remains in 0 until over writhen on the next load
But if you load at index 1 or higher the data will be over writhen with the next lower index value.
This can also be used with multidimensional arrays Array[100,5]
You could load all 5 words of a step at the same time and shifted together on 1 trigger.