Use of FIFO / LIFO commands in RSLogix

AusScott

Member
Join Date
Sep 2006
Location
Victoria
Posts
4
Hi, We have an application where we are using a FIFO list to track parts moving through a queue. the FIFO Load/Unload pair is working without issue. We now have the situation where we would like to add another object back into the top of the queue and have it be used by the next FIFO instruction. What would be the best way to make this happen? is it possible to use the LIFO load command with the FIFO control var and have it achieve the desired result?
We currently have AB PLC-5/20E's (RSLogix5) & AB Control Logix 5555 (RSLogix5000)
Cheers,

Scott
 
Scott,

I am not real clear on the proble. I think you are saying that you have a FIFO stack, but suddenly you may need to stick a number at the top instead of the bottom. I have never seen it tried. Be aware of this from the RSLogix Help file for LFL:
Warning! Except when pairing stack instructions, do not use the same control address for any other instruction. Unexpected operation could result with possible equipment damage and/or personal injury.
Rockwell Software 2000

I think it would be difficult to use LIFO to load anything into an existing FIFO stack. You need to find a different method.
 
Lancie1 said:
I think you are saying that you have a FIFO stack, but suddenly you may need to stick a number at the top instead of the bottom.

Gday Lancie1, Thats it exactly. I have been able to try the FIFO/LIFO mixture on a CLogix 5555 proc but no luck. I think it might be possible with some mucking about with the control var but would like to keep it simple. there is also the question of adding adding objects to a full stack, at the other end one would have to be pushed out wouldn't it?

I think that using a LIFO stack in combination with the FIFO stack in question would be better. that is, as each object is unloaded from the FIFO stack, load it into the LIFO as a type of recycle bin. then if we require to "Roll back" then simply negate the FIFO unload logic and unload from the LIFO stack instead.

a bit more memory intensive but simpler to follow, do you think?
Many thanks for your reply,
Cheers.
Scott.
 
Scott, greetings from hillbilly heaven.

Yes, using both a LIFO and a FIFO is not a bad idea. Make both active, bbut pick the one you need at the time. I will try to remember that little trick for future use.
 
Hmmm, have run into an issue with LIFO's (& FIFO's) tho, they dont seem to auto recycle. What I mean is that they will continue to populate until they reach the array's limit and then cease to add. I would like to have the array push the oldest object our when the newest one is added.
might have to think a bit more on this one.
Cheers,
 
Let's see if I can model your problem. You have a FIFO with something like FFL FIFO = N17:0 Source = N7:0 Control = R6:0 Length = 10 and FFU FIFO = N17:0 Destination = N7:1 Control = R6:0 Length = 10. This means that data about the part entering is in N7:0 and Data about the part exiting will be in N7:1. Now you want to hand add a part whose Data is in N7:2 into the queue and have it be the next part to exit. The FIFO functions by adding new Sources at N17:[R6:0.pos] and removes Destinations by Emptying N17:0 and copying N17:1 N17:0 length 9. To add a part as you describe you need to several copy instructions as follows: N17:9 to N17:10, N17:8 to N17:9, ... N17:0 to N17:1 copy N7:2 to N17:0 and add 1 to R6:0.pos.
 
I would like to have the array push the oldest object our when the newest one is added.

The Bit-Shift Left (BSL instruction) would be the one that pushes the oldest bit out when new one is added. However, it only shifts one bit at a time, instead of the 16-bit words handled by your Fifo and Lifo instructions.

Bob has described how to do your operation "manually". That may be the easiest way, without completely changing what you already have.
 
Last edited:
You can skip the FFU, FFL stuff and just use a file COPy with indexed addressing. Then you just have to manipulate the indices to get the FIFO or LIFO result for each situation. Be careful not to overwrite the file when doing it this way. In other words, be sure you move (COPy) the old data first, then move the new data into the appropriate spot.
 
Gday All,
Many thanks for your input Lancie1 i have decided to do away with mucking about with FIFO/LIFOs so that i can have some flexibility. OkiePC, like your idea I have decided to limit the amount of "history objects" that I track to three. this arbitrary number should allow us to keep the required code short and sweet. I next set up a vanilla array of objects with the appropriate number of members. once done i simply use two rungs of logic one to load and another to unload. the load command copies data from array[1] -> array[2], array[0] -> array[1] and then the desired object to array[0]. the unload command uses the same mechanism but in reverse. it will also write a "null" object (depending on the application) to array[3] to aid troubleshooting etc. i have also implemented a control dint to track the number of objects in the history array to prevent unloading of "null" objects.
upon the requirement to "recycle" an object, the existing FIFO unload trigger will be monitored and the FIFO unload rung negated for the duration of the trigger. while the rung is negated, the "history" array unload rung is activated, which unloads to the destination var.
this process seems to work nicely in the workshop, does anyone have any further comments on its efficiency?
Cheers,
Scott
 
IMHO you're headed in a better direction. It's easier to make, modify and understand your own functions. If you've not already done it, you can use subroutines to call the same code with different addresses. We don't usually use the subs as actual subroutines, instead using them just to break the code up into chunks for documentation/readability, however for this application they would be nice.
 

Similar Topics

Hi friends, I have a big question and a big problem, I'm new to programming PLC, I have a system where we use a cognex data reader to read a code...
Replies
2
Views
1,828
I have been trying to get to grips with the LIFO and FIFO functions using Compact Logix but it seems that if you have multiple LFL instructions on...
Replies
3
Views
2,170
Well HI all I am trying to use the FiFo/LiFo with a S7 300 and I am not to sure how to use it. I think I need the ATT table so that I could store...
Replies
4
Views
4,498
I’m new user of S7, so I want to use the FIFO LIFO, I do as the help says,I create a DB1 and put the information, but it does not work when I test...
Replies
2
Views
2,204
Hi to everyone. Kindly discuss when to used LIFO & FIFO Instruction. I appreciate if you can give actual application on the use of this instruction.
Replies
10
Views
14,490
Back
Top Bottom