Allen Brdley FIFO

pobs

Member
Join Date
Sep 2010
Location
Adelaide
Posts
8
Hi guys, Can anyone help me,
I having a programming problem at work. I have 4 meltpots which need to be kept topped up with pigs of metal, fed from a single conveyor. Due to heat loss from the cold pigs going in I am only allowed to add 1 cold pig in every 15mins, and they must be fed in the order that they "call" for a pig. I use a simple limit switch on a float to call for a pig and a cats whisker limit switch to say the pig has arrived at the pot. I thought this would be a simple job using a FIFO program. I have been on this for weeks now and cannot get the FIFO to work properly. The call for pig moves a number into N7:0, which I then load into the FFL though a one shot. I store it in #B10:0. I then unload it though a one shot from the FFU but I can't get it to turn on a output. I am using a Micrologix 1400. I used all the addresses from the help file in RS500 but i must be doing something wrong.
 
Don't use a FIFO. Use a simple COP instruction. For example, if the Queue has a length of 4 then move your new data into N7:4 and then copy 4 words of data from N7:1 to N7:0. The oldest data will appear at N7:0.

Good luck,

(8{)} :) .)
(Yosi)
 
Thanks for your reply Yosi. I know I'm asking a lot but could you send me a ladder dia so I can understand what you mean.
 
You may need to post your code for reference.

FIFO's can be very handy, however you have to pay very close attention to detail as FIFO's can get "stuck" depending how you are using them. For example, if you have a melting pot call for a pig, and prior to the pig arriving the pot goes "offline". Well you need to ensure that the FIFO properly clears down the corresponding request in this situation to ensure it is removed from the FIFO array, otherwise the "offline" pot will be referenced.

As for triggering your output, realize the FFU is only there to clear down the first entry of the FIFO array when triggered (your cat whisker limit switch). View the first value in your FIFO array is the "current requester". If your array is the following:
N7:0
N7:1
N7:2
N7:3
.
.
.
N7:n

Then the value in N7:0 is always the current requester, therefore your output control is always:
If N7:0 = 1, then Melting Pot 1 Current requester, trigger output
If N7:0 = 2, then Melting Pot 2 Current requester, trigger output
If N7:0 = 3, then Melting Pot 3 Current requester, trigger output
If N7:0 = 4, then Melting Pot 4 Current requester, trigger output

I encourage you to really understand bigger picture of what you are trying to program, you are building a material queue system, which is very handy and applicable in many arenas. If you can understand the concepts, and build a robust solution put it in your library of knowledge as you'll probably encounter the same situation in the future. So don't forget the lesson!

On a side note, to make this a more advanced topic I view material queue systems not as a FIFO but as a FIAO, "First-In, Any-Out". It's a hybrid solution where I can account for situations when a value needs to be removed from the array at any given time. Maybe a system is taken offline, or went into error. I also tie this to a pop up control window on the HMI. This allows operators to manipulate the queue as needed. They can manually add it to the queue, manually remove from the queue and even re-arrange the order of the queue. This ensures that the material queue system can be manipulated via the HMI and I get uninterrupted sleep. More prevalent in batching situations where a single source can only provide to a single destination at any given time.
 
Hi Paully's5.0, Thanks very much for your answer. Just want to get something straight in my head. What your saying is as soon as I write a value to the FFL it is outputted and the FFU is used to get rid of the value therefore both boxes should be on the same rung, so pulsing a value in at the same time removes the last value.
 
You really need to read and understand the FFL and FFU instruction set. Read the help files.

The FFL and FFU instructions are triggered INDEPENDENTLY based on your conditions of when you want to load your FIFO array. They each manipulate the same data file.

When a melting pot "calls" for a pig and the time constraint has been met, trigger the FFL to load a value into the FIFO array, this value should be a unique ID that identifies the melting pot which made the request.

When the cat whisker limit switch is made, trigger the FFU instruction to remove the value from the array.

Reference the first array element in the FIFO array to setup the routing control of that pig. If N7:0 = 1, move converyor to Melting Pot 1, start conveyor.,.etc.
 
Thanks for your reply Yosi. I know I'm asking a lot but could you send me a ladder dia so I can understand what you mean.

Paste this code into your program. You'll have to create N9:0

Here's how it works:
When the input condition is true the data to move into the FIFO is transferred to the first position in the FIFO and the rest of the FIFO is copied using the COP instruction. The oldest data appears at N7:0.


XIC B3:0/0 OSR B3:0/1 BST MOV N9:0 N7:4 NXB COP #N7:1 #N7:0 1 BND

Good luck and sorry this took so long.

(8{)} :) .)
(Yosi)
 
When the input condition is true the data to move into the FIFO is transferred to the first position in the FIFO and the rest of the FIFO is copied using the COP instruction. The oldest data appears at N7:0.

XIC B3:0/0 OSR B3:0/1 BST MOV N9:0 N7:4 NXB COP #N7:1 #N7:0 1 BND
Should it not be explained like this?
"When the input condition is true the data to move into the FIFO is transferred to the LAST position in the FIFO (N7:4) ..."

On the other hand, maybe you really meant that the last or highest number N7:4 would contain the first melting pot to be done, as it said in the Bible, "So the last shall be first, and the first last... [Matthew 20:16]"

It should work much better if you put the number of pigs (4) in the COP as the number of copies (or word shifts) to be done:
XIC B3:0/0 OSR B3:0/1 BST MOV N9:0 N7:4 NXB COP #N7:1 #N7:0 4 BND

The problems arise when there are a differnt number of pigs to be done. Suppose only 1 or 2 or 3 are in use? There is no easy way to change the COP Length. It only accepts a constant number, not an indirect-address.

When all is said and done, it is often easier just to use the FFL and FFU instructions (with a Length = 4 in this case).
 
Last edited:
Whoops! Yes, the length should be 4 and not 1. Sorry about that. Done in a hurry.

Thanks for the correction Lancie1.

With that I said I have to disagree that use of the FIFO is easier. You can make the COP length as long as you need (ie. maximum = 10 for example) and decide where the end of the queue is programatically simply by using the relevant location in N7. For example, if you changed the code to shift 10 words and your queue was 5 pigs long the end of the queue would be N7:5. If it was 3 pigs long the end of the queue would be N7:7.

Cheers,

(8{)} :) .)
(Yosi)
 
For example, if you changed the code to shift 10 words and your queue was 5 pigs long the end of the queue would be N7:5. If it was 3 pigs long the end of the queue would be N7:7.
Yes, if the number of pigs is always 3, or 5, or some other constant, then it is not too hard to make a COP shift all pig locations correctly. But what if the number of pigs varies from 0 to 10? Suppose when the process first starts up at shift change, there are no pigs allowed on the conveyor (due to converyor not able to start fully loaded), but as the process comes up to speed, as many as 10 pigs could be on the conveyor? How do you easily handle a shifting number of pigs or items when using the COP instruction? It seems a little difficult because the Length parameter cannot be a variable (as in many other instructions). For some situations, the COP can easily be used, but for others it requires a lot of data manipulation to make COP shift correctly.
 
Yes, if the number of pigs is always 3, or 5, or some other constant, then it is not too hard to make a COP shift all pig locations correctly. But what if the number of pigs varies from 0 to 10?

Absolutely not! Very simple to do with a sub instruction and indirect addressing. Once the maximum length is determined, say 10, the variable output of queue would be 10-number of pigs.

SUB 10-NumPigs -> Index
COP N7:1 N7:0 10
MOV N7[Index] -> Output of queue

I've used the COP method dozens of times over the years. I'm a big proponent of using simple instructions to their fullest as opposed to using the fancy instructions with control structures. The PLC-2 days are long gone, the vast majority of FAL, FIFO, etc... instructions in use are superfluous (not to mention confusing).

Cheers,

(8{)} :) .)
(Yosi)
 
Last edited:
I thought maybe you had found a work-around, but I see that it still requires a routine for each possible Length for the COP. That is how I have done it before. Then I found that one set of FFL and FFU's would easilly do the job for any number of variable Lengths (Position pointer in the FIFO) from 0 to 255.
 
Last edited:
I thought maybe you had found a work-around, but I see that it still requires a routine for each possible Length for the COP. That is how I have done it before. Then I found that one set of FFL and FFU's would easilly do the job for any number of variable Lengths (Position pointer in the FIFO) from 0 to 255.

There is absolutely no reason for a separate routine for each COP length! It's all very simple! Who cares if the number continues to be shifted even though it's no longer useful. That's the point. Set the COP length to the maximum you'll ever need and extract the data by examining the element in the location based you your requirements. It is much simpler and faster than an FFL/FFU pair and all of that length manipulation.

Cheers,

(8{)} :) .)
(Yosi)
 
Who cares if the number continues to be shifted even though it's no longer useful?
I recently ran into a situation where the extra data above the "useful" point really did contain data that needed to be preserved. But the COP destroyed it due to the changing Length parameter. See this thread at about Page 5, Post #42. That is when the COP was abandoned in favor of the FIFO. Do you have suggestions on how to fix the COP version?

http://www.plctalk.net/qanda/showthread.php?t=80080&highlight=Industrial+Control+Simulator&page=5
 
Last edited:
pobs,

I have a post with a fifo load and unload from several years back with an example program. I do not know how to search for my posts or I am doing something wrong.

maybe someone can find the post.
regards,
james
 

Similar Topics

in allen bradley kinetix 300 drive first E31 error shows after resting drive E11 error occurs need solution to reset E11 fault code
Replies
4
Views
157
Hi, I have a ControlLogix system with 1756-IF16 analogue inputs. I can't scale the inputs at the card as there is a requirement to facilitate...
Replies
14
Views
432
Dear community, I am trying to find a tool for Allen-Bradley PLCs similar to SiVArch for Siemens PLCs to automatically generate faceplates and...
Replies
0
Views
114
Hi everyone, new to forum. Since very long time i having issue with 1734-AENT module, after some period of time its keep stuck in error (simmilar...
Replies
20
Views
867
Back
Top Bottom