FFU and FFL is not loading the data

Join Date
Feb 2016
Location
Raleigh
Posts
3
Hey guys, I came across one question about the FIFO, FFL & FFU instruction.
I want to measure the wheel speed, so I use the RPM encoder as the source, I load the value from the high speed counter, then load to the array tag.
However, the FFU and FFL is just loading the value to the first bit (LW_For_RPM_Speed_Array.[0]), I have attached my snips here. Can you guys just look at the attachment and figure out what's wrong with this program?:unsure::unsure::unsure:

FFU and FFL.jpg
 
It looks to me that you're unloading immediately after you load. As soon as you put the data in you pull it back out again. One solution might be to add an XIC LW_for_FFL_Control.DN to your second rung so that the FFU will only execute once the FIFO stack is full.
 
It looks to me that you're unloading immediately after you load. As soon as you put the data in you pull it back out again. One solution might be to add an XIC LW_for_FFL_Control.DN to your second rung so that the FFU will only execute once the FIFO stack is full.
Yes, I want to unload the data just as soon as it loads i to the array, since later, I would make an average of the whole array, that would make the spped average more consistent.
If I don't need to unload the data when the stack is full, Can I still keep the program I attached?
 
although the FIFO construction is "designed" to do what you want - many (most?) programmers find it easier to use a "home brew" RATCHET or RIPPLE construction instead ... they seem to find this approach easier than having to Load and Unload the FIFO stack - and more flexible for storing the data in the array ...

http://www.plctalk.net/qanda/showthread.php?p=360484&postcount=3

the link above will show you the RATCHET - and the following post in the same thread will show you the RIPPLE ...
 
I don't understand why you need to "Unload" as soon as you "Load". That means there is no need for a FIFO.

If you need to use the value you load, it is still available in your "Local_Input_3" tag.

In similar situations, I let the FIFO fill up, and then pop one off every cycle when it is full. I also put the unload first, so that there is always room in the stack to load new data.

I also use the .POS control element in AVE instructions as the length, so that a more accurate value is displayed as the FIFO is filling.
 
I don't understand why you need to "Unload" as soon as you "Load". That means there is no need for a FIFO.

If you need to use the value you load, it is still available in your "Local_Input_3" tag.

In similar situations, I let the FIFO fill up, and then pop one off every cycle when it is full. I also put the unload first, so that there is always room in the stack to load new data.

I also use the .POS control element in AVE instructions as the length, so that a more accurate value is displayed as the FIFO is filling.

CUZ What I need is the value within the array tag, what i want to do is to AVERAGE the value within the array tag, then the average value returned is the value I need. That is the reason for me to unload it as soon as I Load it
 
I approach it slightly differently - each time I go to load the FIFO, I check if the array is full (control array .DN bit on). If so I unload it (FFU) to give me some space, and then load my new data (FFL). Then I do my averaging calculations after that.
 
If you don't need a variable length array, then you really don't need the overhead and extra logic provided by the FFU/FFL pair. Just use the "ratchet" COPy as Ron suggests.

If you do want to average when the array is less than full then do as ASF suggests and FFU right before the FFL but only if DN (full). And you need to use the POSition as part of the logic doing the averaging so you don't include old or invalid (not yet loaded) numbers in your math.
 
If you unload it as soon as you load it, there will never be anything in the array to average.

Line 1 of your code loads the value from Local_Input_3 into LW_For_Speed_Array at the position in the array indicated by Position and then adds 1 to the Position. So the first time this runs Local_Input_3 would be copied to LW_For_Speed_Array[0] and Position goes from 0 to 1.

Line 2 of your code copies the value from LW_For_Speed_Array at (Position - 1) to LW_Forward_Array_Ind... and makes the value in the array 0. It then subtracts 1 from Position. The first time your code runs LW_For_Speed_Array[0] would return to 0 and Position would go from 1 back to 0.

If you try to run the AVE command on this array you're going to return a 0 every time. The only way to keep this from happening is to not run the FFU command unless the array is full. And, as rdrast said, you'll want to swap the order of the first two rungs and use the .POS of the FIFO control as your length in your AVE command.
 

Similar Topics

For those who may recall I had posted previously about the FSC instruction, and while I have a better understanding of how to use it I find myself...
Replies
1
Views
1,382
A couple of questions with RS500 FFL-FFU instruction set. 1-Does the stack load from the bottom or the top, My stack is #N7:50 with a length of...
Replies
7
Views
1,597
I have used fifo's before, and I think I understand the general concept. However I am having trouble trying to create one that stores the...
Replies
19
Views
11,240
When executing a FFU to unload the oldest value the data in the file is shifted down and the position value is changed. Does this shifting take...
Replies
12
Views
3,387
Hello, I'm currently programming a MicroLogix 1400 in RSLogix Micro, and I'm trying to put data into FIFO queues. Would you know how to use the...
Replies
4
Views
5,084
Back
Top Bottom