Difference between FC and FB in Siemens PLC

We have seen about siemens plc programming blocks in my previous article. We have seen in that article about different types of plc programming blocks and how can we use them in the programming.

In this article, we are going to see the difference between FC and FB blocks in the siemens plc system. So let’s start the blog.


Difference Between FC and FB in Siemens PLC

Function (FC) and Function Block (FB) both are just like a subroutine. Users can create a part of the logic in this block and then call it each time when required to execute that logic.

This logic must be such as,

Function (FC) and Function Block (FB) both are used to optimize user programming. The main use of FC and FB is to divide and organize the user program into smaller parts that can be easily understood. It helps in maintenance and troubleshooting.

FC and FB can be created by the user and used as a user library. So, users have to just write it once, and can be used as many times as required. This also reduces and rationalizes the resources of the CPU, such as memory occupation.


What is Function(FC)?

A Function(FC) is a logic block without memory. This block can be created by the user and called as many times as required. We can assign different parameters in the function such as In, Out, In-Out, Temp.

difference between fc and fb in siemens

Temp variables defined in the FC are stored in the local data stack, which will be lost after the execution of FC.

difference between fc and fb in siemens

The above image shows the FC blocks for the motor starter. All the parameters such In, Out, In-Out have to fill with the address.

 

What is Function Block(FB)?

A Function Block(FB) is a logic block with memory. This block can also be created by the user and called as many times as required. The difference is whenever we called a Function Block(FB), it creates a DB as its memory. This DB is called an instance data block.

difference between fc and fb in siemens

We can also assign different parameters in the function block as In, Out, In-Out, Temp, and Stat, which is an additional parameter in the FB. Data saved in the instance data block is not lost after the execution of the FB. Static variables are stored in the instance data block. However, Temp data is stored in the local data stack which is lost after the execution of FB.

difference between fc and fb in siemens

The above image shows the Function Block(FB) for the control valve operation. You need not enter all the parameters with the address. FB will generate an instance data block with each call.


Summary

⇒ The main difference is FC has no instance memory, while FB has an instance Data Block(DB). This instance data block saves all the parameters of In, Out, In-Out, and Stat. They can be accessible even after the execution of FB.

⇒ We can program FC or FB with FBD, LAD, STL, and SCL. The FB has additional capabilities to program in Graph.

⇒ Whenever we called for FB, it generated an instance Data Block(DB) with it. There is no such necessity for FC.

⇒ In FC, we can not leave any parameters such In, Out, In-Out blank. Since all the formal parameters in FC do not save in any memory and as a result there is no initial value assigned to them. In FB, we can leave any of the parameters such as In, Out, In-Out with no address.

 

I hope you like this article about the difference between FC and FB in Siemens PLC programming blocks. Please share this blog with your colleagues and friends!

 

You can read articles about PLC,

Logic gates using PLC ladder language.

⇒ Most popular 5 different types of plc programming languages.

⇒ Siemens PLC programming blocks.

⇒ 30+ most useful PLC communication protocols.

⇒ Basics of Different Types of PLC Modules

 

You can read more articles about Electrical and you can also find books that boost your knowledge in the field of Instrumentation

Thanks for reading!

SHARE THIS BLOG,

Leave a Comment