In a previous article regarding ControlLogix processor faults, I mentioned one of the ways a processor can be faulted was by causing an array to go out of bounds when using an FFL and FFU instruction.

These instructions are commonly used to store multiple records at a given sample rate, which then can be averaged.

In today’s article I’ll walk you through setting the parameters of these instructions to do just that.

Image by Brandon Cooper

The first step is of the process is to record samples of your value or analog signal (level, temperature, pressure, etc) over a given amount of time.

We can accomplish this by using a Timer to trigger FFL and FFU instructions, and below I cover each of their parameters:

FFL (FIFO Load) Instruction Parameters:

Source – The signal or variable that you want to store in the array.

Generally, this would be a process variable like a weight scale, pH, or temperature.

FIFO – The Array in which to store the signal or variable.

In this example I’m using ACCArray[16] with a DINT data type

Control – This can be any tag name with “CONTROL” as the data type.

Note that the corresponding “FFU” (FIFO Unload) instruction must use the same tag in its “Control” parameter so that they operate simultaneously.

Length – Length of the Array.

This is usually the same length as the Tag Array used in the FIFO parameter.

Position – Position to Load the Array

FFU (FIFO Unload) Instruction Parameters:

FIFO – The Array in which to Unload the variable.

In this example I’m using the same ACCArray[16] with a DINT data type used above.

Destination – The variable that is being “Unloaded” from the array will be moved to this destination.

I chose a tag called “Trash” because I don’t need the variable once it has been unloaded.

Control – This can be any tag name and select “CONTROL” as the data type.

As noted above, the corresponding “FFL” instruction must use the same tag in its “Control” parameter so that they operate simultaneously.

Length – Length of the Array

Position – Position to Unload the Array

With the FFL and FFU covered, the next step is to use the AVG instruction to average the values we’ve collected and stored in our array, and below I’ll detail the AVE’s parameters:

AV (Average) Instruction Parameters:

Array – The Array which hold the values you wish to calculate an Average of

Dem. To Vary – The array’s Dimension to use (0, 1, 2)

This parameter allows users with multi-dimensional arrays to select the dimension in the array to use (- ed.)

Destination – Where to place the Result of the Average Instruction. Consider this a “MOV” block inside the AVG instruction.

Control – This will be a CONTROL data type similar to the one used in the FFL and FFU instructions, but can not be the same tag as the FFL and FFU instructions. The AVG instruction needs to have its own dedicated CONTROL tag.

Length – The length of the array to AVERAGE.

In some situations you may only want or need to Average a part of the array, but it’s more common to Average all of the stored variables.

Position – The offset into the selected array which the instruction is accessing.

This value is typically set initially to 0. (- ed.)

NOTES: Adjustments for sampling options:

  • Make the array larger: Instead of only 16 stored data points as in this example, your array could be 50 points or more.
  • Increase or decrease the timer preset to have faster or slower sampling: In this example I’ve adjusted the TIMER_LAB.PRESET to five hundred milliseconds, which results in the code sampling and store the signal value twice a second. Depending on what you are trying to accomplish, you may only need a sample every ten seconds, or you may need a sample every fifty milliseconds

The following is a snapshot of what your array will look like in the controller tag database:

Image by Brandon Cooper


The FFL and FFU instructions working together with and AVG instruction can give you great flexibility in adjusting the sample rate by simply adjusting the timer value that executes the instructions.

This is a real-life application that I have used many times for calculating weight signals and averaging the weight over several seconds.

If you are new to ControlLogix programming, hopefully you have picked up a tip or two here. If you take the time to learn each instruction, their parameters and use, then you will be setting yourself up for success in your automation and controls career.

Written by Brandon Cooper
Senior Controls Engineer and Freelance Writer

Have a question? Join our community of pros to take part in the discussion! You'll also find all of our automation courses at

Sponsor and Advertise: Get your product or service in front of our 75K followers while also supporting independent automation journalism by sponsoring or advertising with us! Learn more in our Media Guide here, or contact us using this form.

Brandon Cooper


Please enter your comment!
Please enter your name here