Function block One of the official and widely used PLC programming languages is Function Block Diagram (FBD). It is a simple and graphical way to program any functions together in a PLC program. Function Block Diagram is easy to learn and provides a lot of possibilities.
As one of the official PLC programming languages described in IEC 61131-3, FBD is fundamental for all PLC programmers. It is a great way to implement everything from logic to timers, PID controllers etc.
Most engineers love FBD because it is graphically a very common way to describe a system. Engineers like to put things in boxes. And that is exactly what the concept of function block diagrams is.
In this tutorial I will introduce you to some of the basic principles of FBD programming and the function blocks.
What is Function Block Diagram?
From systems engineering you might already know something also called function block diagrams. PLC function block diagram is not that different from it. What FBD offers is a way to put functions written with many lines of code into boxes.
Thereby we can easily connect them, to make a bigger PLC program.
As with ladder logic and structured text, function block diagrams or FBD is described in the standard IEC 61131-3 by PLCOpen. Most PLC programs are written with some amount of FBD. Because, even though you might write your functions in structured text. You still, most of the times, have to connect those functions.
In FBD all functions are put into function blocks. They all have one or more inputs and outputs. The function of the block is the relation between the state of its inputs and outputs.
Here’s how a simple function block could look like:
Function block illustration in FBD
The function block is illustrated with a box. In the middle of the box is often a symbol or a text. This symbol represents the actual functionality of the function block.
Depending on the function there can be any number of inputs and outputs on the function block. You can connect the output of one function block to the input of another. Thereby creating a Function Block Diagram.
There are many standard function blocks provided in FBD.But you can also make your own function blocks. Often, you will have to use the same piece of code in your PLC program multiple times. It could be a function for controlling a valve, a motor etc. With function blocks you can make a function block specific for a motor and use it several times.