According to the IEC 61131-3 standard, there is a difference between a function and a function block in PLC programming. The main difference involves internal memory. So for instance, a function can be described as something like an equation or formula that accepts inputs and calculates an output value. Moreover, it always returns the same output value for the same inputs. In contrast, a function block relies on internal memory. So it is possible to have a different output value with the same inputs because there is another value stored in memory that has an impact on the final output value.
Function blocks form the basis of the Function Block Diagram (FBD) PLC programming language, one of the five languages specified by the standard, the others being two textual languages [IL (Instruction List) and ST (Structured Text)] and three graphical languages, beside FBD including LD (Ladder Diagram) and SFC (Sequential Function Charts).
In FBD, function blocks describe the function between input and output variables. Inputs and outputs of blocks are connected together via connections or lines in the programming environment. The block represents some function or other; for example, it can be an elementary function such as MOVE or COMPARE, or a typical logic function like logical AND or logical OR.
The idea behind IEC 61131-3 was to have a vendor independent standard for PLC programming languages. The FBD language is structured as a logical sequence of functions, with the direction of execution being from left to right. Input values have to be generated before function block execution, and network evaluation isn’t finished unless all the output values are calculated.
More about function blocks and IEC 61131-3 standards can be found at the Open PLC website.