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 🙂
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,
We run the FFL command with the Timer set to 5 seconds and write our BarcodeNo variable into the BarcodeArray 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 array to BarcodeArray in a continuous order.
In the Position value, you can follow which line or element of the array the FFL command has written.
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.
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 which you can see below.
BarcodeArray – 1st element of array
BarcodeArray – 2nd element of array
BarcodeArray – 3rd element of array
|Data to be stored in the FIFO|
|array tag||FIFO to modify|
Specify the first element of the FIFO
|Control||CONTROL||tag||Control structure for the operation|
Typically use the same CONTROL as the associated FFU
|Length||DINT||immediate||Maximum number of elements the FIFO can hold at one time|
|Position||DINT||immediate||Next location in the FIFO where the instruction loads data|
initial value is typically 0
|.EN||BOOL||The enable bit indicates the FFL instruction is enabled.|
|.DN||BOOL||The done bit is set to indicate that the FIFO is full. The .DN bit inhibits loading the FIFO until .POS < .LEN.|
|.EM||BOOL||The empty bit indicates the FIFO is empty. If .LEN is < or = to 0 or .POS < 0, the .EM bit and .DN bits are set.|
|.LEN||DINT||The length word specifies the maximum number of elements in the FIFO.|
|.POS||DINT||The position word identifies the location in the FIFO where the instruction loads the next value.|