Differences between Functions and Function Blocks
It is important to clearly understand what is different between functions and function blocks.
- A Function A function calculates a result according to the current value of its inputs. A function has no internal data and is not linked to declared instances. is called once and it performs an action.
- This is synchronous.
- A Function Block A function block groups an algorithm and a set of private data. It has inputs and outputs. (FB) is an instance that has its own set of data.
- An FB maintains its own, internal machine state and often has an output to indicate when the work is done.
- An FB is asynchronous.
- The best way to work with a function block is to call it during multiple scan.
- This triggers the action the first time, then monitor the status of this action, especially via the Done output.
See Also