How to use FIFO Block in TIA Portal? – Siemens PLC Programming

First In First Out (FIFO)

Regarding the Programming Engineers, there is always an idiom stating that “It is not about your code result, it is always about how did you make it.”

So, today we are going to enhance our programming skills by learning a new tool that will help us to build a (first input first output) register.

But before we are getting started, we need to know why we need such instruction? and when are we supposed to use it? so clear your mind and stay tuned.

The Function and Application of FIFO Block

FIFO is a structure used in hardware or software applications when you need to buffer data.

Basically, you can think about a FIFO as a bus queue, the people that arrive first is the one who catches the bus first.

Function and Application of FIFO Block

Sometimes your input data and field signals are being done faster than the system outputs that you have to make, so in order to handle such a situation you have to make an instruction that slows down the flow of input data and at the same time you have to store these data safely and by its turn.

Simply that is what a FIFO block can do, it outputs the oldest entry of the “FIFO” table as function value then the number of entries is decremented by one and If there are still entries in the table, these are shifted down.

Steps for Configuring FIFO Table in TIA Portal

First of all, you have to understand that this operation needs two instructions.

  • One for loading the FIFO table with the unique sequence “ATT” instruction (Add value to table). Shown in Fig. (1)
  • Another one for unloading the FIFO table “FIFO” instruction. As figured in Fig. (2)
Steps for Configuring FIFO Table in TIA Portal
Figure 1
fifo instruction in tia portal
Figure 2

Creating the FIFO register (DB)

By pressing the right click on program blocks you can choose Add new block.

Creating the FIFO register
Figure 3

Configuring the FIFO database

Then we have to configure the database as illustrated in the next figure. Fig. (4)

  • The first entry in the table specifies the maximum length of the table.
  • The second entry in the table specifies the number of existing entries.
  • The third entry in the table contains the first word of data.
Configuring of FIFO database
Figure 4

Coding the FIFO block in the Main OB

As we can see in the next figure Fig. (5), the first network is responsible for unloading our FIFO table by activating M0.0 automatically the data in turn will be transmitted to MW2.

And for the second network, we can see that it is responsible for loading the table by activating M1.0 automatically the data in MW4 will take its turn into the FIFO table.

Note: the word (P#DB1.DBX0.0) stands for the start address of your table.

FIFO logic in Siemens PLC
Figure 5

If you liked this article, then please subscribe to our YouTube Channel for Electrical, Electronics, Instrumentation, PLC, and SCADA video tutorials.

You can also follow us on Facebook and Twitter to receive daily updates.

Read Next:

Don't Miss Our Updates
Be the first to get exclusive content straight to your email.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address

Leave a Comment