RSLogix 500/ML1100 FIFO question

timbo_uk

Member
Join Date
Nov 2005
Location
Bradford, UK
Posts
336
Hi,

Just starting to code a new project. Not used FIFO's before. I have read the instruction help file in RSLogix, and think I have got it :unsure:.

CAn you look at the attached ladder and see if I am on the right lines.

The idea is when a tank is empty the tank number is loaded into the buffer, then ignored until it has been filled.

In a later ladder, before the tank is actually filled I will check the status of the input again before filling. After filling I will reset the latch.

Hopefully I got this right!

Fingers crossed
 
Good morning.

To be honest with you I don't see why you need a FIFO (Actually,
I don't see a need for the FIFO instruction [or Counters, or SEQuencers...] at all).

Furthermore, I don't see you unloading the data.

It is a very simple task to build a FIFO using a COPy instruction. It's also cheaper on user memory and faster.

This is how you do it:

Pulse the input (If you're using the (L) as a condition to the instruction you don't need the ONeShot) to the COPy instruction. Copy 1 file to itself with an offset of 1. For example COPy N10:1 to N10:0. Don't reverse those addresses because you'll fill the entire file with the contents of the 1st register. The beginning of the FIFO is the last address in the file and the end of the FIFO is the 1st element in the file (N10:0).

Good Luck,

(8{)} :) .)
(Yosi)
 
Good morning.

To be honest with you I don't see why you need a FIFO (Actually,
I don't see a need for the FIFO instruction [or Counters, or SEQuencers...] at all).

Furthermore, I don't see you unloading the data.

It is a very simple task to build a FIFO using a COPy instruction. It's also cheaper on user memory and faster.

This is how you do it:

Pulse the input (If you're using the (L) as a condition to the instruction you don't need the ONeShot) to the COPy instruction. Copy 1 file to itself with an offset of 1. For example COPy N10:1 to N10:0. Don't reverse those addresses because you'll fill the entire file with the contents of the 1st register. The beginning of the FIFO is the last address in the file and the end of the FIFO is the 1st element in the file (N10:0).

Good Luck,

(8{)} :) .)
(Yosi)

Sounds like a lot of copies to me ??
There are 13 tanks in total, the ladder shown is just for a few of them, for the loading only (trying out ideas). The unload ladder is to be written later.
 
Please can anyone have a look at the ladder and tell me why it does not load anything, I am confused after reading the help file too; I really need to get moving on this project tonight.

Thanks (Hopefully! :))
 
The FFL instruction should operate once per false to true transition.

Notice that the position will affect the placement of the items in the data table.

The stack is 13 elements long, so when it is empty, and the first rung goes true, the value 13 will appear at N7:8 (N7:8=R6:0.POS+FIFO Base Address). The position will increment to 1, and the EM bit will turn off.

Then lets say the second FFL goes true. A value of 1 will be stored at N7:9.

And so on and so forth, until the FIFO is Full (R6:0/dn). When it is DN, the FFL instruction will not do anything.

So, add your FFU logic, (be sure to include XIO R6:0/EM ahead of it) and use the same control word, and you should see the instruction work as you expect.

BTW: The ONS instructions are redundant since your latches will effectively disable the rung during the next logic scan, so you can do away with those instructions.
 
Last edited:
First, you don't need to use multiple FFL instructions.

Have the source location be another N7:X word. Load the tank numbers into that word with a MOV instruction, then trigger the FFL instruction to load from N7:X.

As you test, watch the words N7:8 - N7:20 words to see what loads if anything.

If you aren't unloading N7:8 - N7:20 with an FFU, then you must clear them manually when testing, otherwise once they are full the FFL won't do anything as it has filled the 13 words with data.

Be sure you're calling the subroutine as well.
 
Okie & Pauly, thanks for the info :)

I did not think about the N7:8 UPWARDS being used for the data, I will move 100 N7:x upwards now to make room :)() is there an easy way to do this in the standard RS Logix (I have typed all tags and comments into them!!!)

The program "was not working" because I was using toggle bit in remote run on the level switches. It works if I force or (as I have just done) actually wire up the input and trigger it!

Paully, I do appreciate (and understand) what you are saying about using a single FFL comand, but I want this program to be easy to follow. I have plenty of space in the ML1100 so far. If towards the end I am getting tight on the space/speed I will look at what you suggest.

I am by no means an expert programmer, virtually self teaching (with help from this excellent forum)and with this project (that I stuck my neck out and said I can do it) after starting to break down required steps am beginning to realise actually how complex it will be.

Basically I have 11 tanks and an outlet for a bucket. These are to be filled with a mixture of up to 6 solvents and sometimes water (can be different for each one.) only one type of solvent can be dispensed to one tank at any time. This is due to the valve arrangements to the tanks.
 
Ok Let's take a step back (keep in mind I'm writing this for future readers as well) -

FIFO (First In First Out) simply means that if Joe walks into the bar, then Bill walks into the bar and finally Steve walks into the bar....Joe must come out before Bill can, and Bill must come out before Steve can. Simple!

So, to achieve this an AB PLC uses two instructions FFL and FFU to load and unload a stack of addresses. The stack of addresses begins and the designated FIFO address, in this example N7:8. The length of the stack is defined in the FFL instruction, again in this example it is 13.

So the FIFO stack is:
N7:8
N7:9
N7:10
N7:11
N7:12
N7:13
N7:14
N7:15
N7:16
N7:17
N7:18
N7:19
N7:20

The FFL instruction loads this stack top - bottom (N7:8 -> N7:20). So N7:8 is the first value in, N7:20 is the last value in.

As the FFL instruction is triggered, it loads the value in the Source field into the FIFO stack. If the stack is empty, it loads it into N7:8, if the stack already has a single value loaded (in N7:8), the next value is placed into N7:9 and so on...

Now, once the stack is completely loaded, that's it. It's done you cannot load anything else until you empty the stack. Which is where the FFU instruction comes into play.

When the FFU instruction is triggered, it takes the first value in the stack and puts it into the defined destination address. The destination address is really just a junk address, as the next time the FFU is triggered it gets overwritten.

When the FFU instruction is triggered it ALWAYS takes the value out of N7:8 (After all that is where the "First In" resides) and puts it into the destination address. If we have a full FIFO stack and the the FFU is triggered the value of N7:8 is moved into destination address and the FFU SHIFTS all the values in the stack UP by 1 address. So the value in N7:9 has now been moved to N7:8, N7:10 has been moved to N7:9....the last address in our stack N7:20 is now empty.

Trigger the FFU again and the N7:8 is dumped to the destination address, all the values shift up and now N7:19 and N7:20 are empty.

At this point, if the FFL were to be triggered, the value in the source address would be placed into N7:19, following our First In First Out order. Make sense?

Couple of items, the FFL and FFU share the same control word, and the length designation must match. I prefer to use one shots to load and unload the addresses. R6:0.POS tells you the address in the stack to be filled next.
 
Paul,

Thats a brilliant explanation. BTW got it working beautifully now. In case anyone is wondering why I am using the FIFO; its because the tanks can take a long time to fill, I can only fill one tank at a time. So the first to get low is always filled.

That explanation should really help somebody searching in the future :)
 
Can I just ask another question? If YOU were writing this, would you use 1 program file for the entire filling process for all tanks (using JMP for tanks not filling) or would you use a seperate program file for each individual tank fill procedure (using JSR to get to relevent file)

The latter is how I have started, but not sure if it will get unweildly???

I have attatched so far.
 
Glad you've got it working!

I typically structure my program so ALL JSR instructions are in LAD 2 each on a separate rung in order. This keeps them all organized and I can tell immediately if I have forgotten a JSR for a program file. The only time I condition a JSR is if I want to disable it using some form of an AFI or test bit. I let the logic within the program file itself handle the control.

I would just use a single FFL/FFU instruction pair and have them in their own FIFO program file as they are tied together. I tend to keep "funcitionally similer" logic together.

If this system only handles the tank functions then I would probably separate them into individual program files. However if this was part of a larger system with a wide varitey of tasks and the fill logic was only 10 - 20 lines, I may stuff it all into a "Tank Fill" program file and separate the logic with Rung Titles.
 
To be honest with you I don't see why you need a FIFO
...possibly because you don't seem to understand the function.

It is a very simple task to build a FIFO using a COPy instruction. It's also cheaper on user memory and faster.

This is how you do it:

Pulse the input (If you're using the (L) as a condition to the instruction you don't need the ONeShot) to the COPy instruction. Copy 1 file to itself with an offset of 1. For example COPy N10:1 to N10:0. Don't reverse those addresses because you'll fill the entire file with the contents of the 1st register. The beginning of the FIFO is the last address in the file and the end of the FIFO is the 1st element in the file (N10:0).
What you describe is a shift register, not a FIFO (or queue).
 
Just for contrast...........

An alternate method could be to write a refill rung to fill the tank when it is empty as if it were the only tank. At the coil of this rung , place a "Tank Filling" coil in parallel with the output coil. Now include this "Tank FIlling" as a Not bit at the beginning of every tank refill rung.

----]/[-----!---] [------------!---------( )
1 ! 2 ! 3
! !
! !
----] [-----! !---------( )
3 1

"2" is your fill condition. And breaks the latch.

Each tank will fill in order of scan of the PLC not in order of when they were empty unless each one fills befor the next is empty.

Using this method if one tank is empty , it fills, while filling tank 1 , no other tank can fill.

When tank 1 is done filling, the next tank can fill.

If more than one tank is waiting to fill, then the PLC scan determines which one fills first. But they will all fill eventually unless you have allot of tanks and the scan gives priority to the same couple of tanks while the others wait.

I might do this with fewer than 5 tanks.

There is only so much you can do with one pump and valve but your method gives every tank a turn in order of being empty no matter how many are waiting or where they are in the code.

I was just thinking of "another way" not sayin it's better.


So with your method, you are limited by the number of entries in the table. I would imagine that you have a table with the same number of entries as you have tanks?

You have made a waiting list of empty tanks. I like it.
 
Paul,

Thats a brilliant explanation. BTW got it working beautifully now. In case anyone is wondering why I am using the FIFO; its because the tanks can take a long time to fill, I can only fill one tank at a time. So the first to get low is always filled.

That explanation should really help somebody searching in the future :)
Hi this is JTC from four years in the future...great explanation Paully's5.0!
 
Last edited:

Similar Topics

I've got a Keyence barcode scanner I've got coming in via Ethernet to a Micrologic 1100. I've got the data coming into N Type Data Files and when...
Replies
12
Views
7,075
I have a little bit of experience with Allen-Bradley. I have a Micrologix 1500 (RSLogix 500) and a PanelView Plus 7 (FactoryTalk View Studio ME)...
Replies
3
Views
106
buen dia. tengo una falla al pasar los tags de mi plc SLC 5 0/4 a mi panel me aparece un error Problem writing value " " to item <tag name>...
Replies
1
Views
73
Will someone please convert this logic to pdf?
Replies
2
Views
119
Hello, Haven't been on in a while. I need to generate a bit level pdf of the I/O for RSLogix 500. I can generate a report but it just shows the...
Replies
1
Views
148
Back
Top Bottom