Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Captcha Click on image to update the captcha .

Login

Register Now

register content

PLC FIFO Instructure Usage (FFL)

In this topic, we will see how the FFL (Fifo Load) command works and we will examine the Fifo command. The FIFO command is a command used in arrays. As the name suggests, it works with First In First Out logic.
Also because arrays are used as local databases in PLC. With the FIFO command, you can store temporary variables and overwrite the oldest ones.

The FIFO command can be used in STL (Structure) and Ladder.

Now let’s see how it is used with an example.

First, we generated numbers ourselves with WallTimeClock using the GSV command. Actually, you can get the time information with this command, but we have used it outside of its purpose 🙂

plc programming gsvcommand wallclock 2 plc

If you want, you can generate numerical values ​​with a different method or enter them manually. The aim is to produce only numerical information.
As you know, you can store all variable tickers in arrays, not just numeric.
Let’s come to our FIFO command,

plc programming TimerRandom 1 plc

 

We run the FFL command with the Timer set to 5 seconds and write our BarcodeNo variable into the BarcodeArray[0] in the FFL command.
Make sure the two variable types are the same.
The FifoCntrl tag in the FFL command is the tag that controls the FFL. You need to create it in the control datatype.
It determines how much space it will write in the Length BarcodeArray array in the FFL command.
In our example, 10 is written in the Length part so that it will fill afield from the BarcodeArray[0] array to BarcodeArray[9] in a continuous order.
In the Position value, you can follow which line or element of the array the FFL command has written.

plc programming FifoPos tag plc

If the command you see in the last line is FFL, if it reaches the Length position, the done bit becomes active. When we use this bit and write a zero to the FifoContrl.POS tag again, it enters the loop from the beginning.

plc programming plc

The position index number shows which elements of the array is processed, that is, its index in the array.

So in the BarcodeArray array, this operation should correspond to BarcodeArray[1] which you can see below.

 

plc programming BarcodeArrayList plc

BarcodeArray[0] – 1st element of array

BarcodeArray[1] – 2nd element of array

BarcodeArray[2] – 3rd element of array

……

plc programming PLC Program Example 2 plc

 

Ladder Diagram

Operand

Type

Format

Description

SourceSINT

INT

DINT

REAL

String type

structure

immediate

tag

Data to be stored in the FIFO
FIFOSINT

INT

DINT

REAL

String type

structure

array tagFIFO to modify

Specify the first element of the FIFO

ControlCONTROLtagControl structure for the operation

Typically use the same CONTROL as the associated FFU

LengthDINTimmediateMaximum number of elements the FIFO can hold at one time
PositionDINTimmediateNext location in the FIFO where the instruction loads data

initial value is typically 0

CONTROL Structure

Mnemonic

Data Type

Description

.ENBOOLThe enable bit indicates the FFL instruction is enabled.
.DNBOOLThe done bit is set to indicate that the FIFO is full. The .DN bit inhibits loading the FIFO until .POS < .LEN.
.EMBOOLThe empty bit indicates the FIFO is empty. If .LEN is < or = to 0 or .POS < 0, the .EM bit and .DN bits are set.
.LENDINTThe length word specifies the maximum number of elements in the FIFO.
.POSDINTThe position word identifies the location in the FIFO where the instruction loads the next value.

 

plc programming plc plc programming Fifo PLC String Array Copy plc plc programming Fifo PLC String Array plc