could you explain me what's the real benefit of using FBs rather than functions
IMHO they are quite similar.
In the general case function is more preferable. It takes a little bit less memory and easy to use (you need not to declare instances). If you can use a function (you need not internal memory in the POU and 1 output is enough) then you have to use it.
With one exception , if we need POU with many 'parameter' (constant) inputs FB can be more suitable, especially in cycles. For example:
Indeed I have only one 'x' varying value, but I have to write in all places:
And each time the compiler will generate code for transferring all parameters.
With FB I can write input parameters only once:
Further in all places (or in cycles) I can write only:
Thank you for the explanation
Log in to post a comment.