You can declare the methods explicitly in order to influence the initialization of function block variables, as well as the behavior when exiting function blocks.
The type of the return value for the implicit methods is BOOL
. The value is not evaluated by the system, but the type should not be changed.
FB_Init
is always available implicitly and it is used primarily for initialization. For a
specific influence, you can also declare the methods explicitly and provide additional
code there with the standard initialization code.
FB_Reinit
has to be implemented explicitly. If this method exists, then it is called after
the instance of the affected function block is copied. That happens during an online change after changes to the function block declaration
(signature change) in order to reinitialize the new instance module. To reinitialize
the basic implementation of the function block, you have to call FB_Reinit
explicitly.
FB_Exit
must be implemented explicitly. If there is an implementation, then the method is
called before the controller removes the code of the function block instance (implicit
call).
The following shows some use cases of these methods for different operating conditions.
-
"First download" operating case
-
"Online Change" operating case
-
"New download" operating case
-
"Start of application" operating case
-
Interface of method
FB_Init
-
Interface of method
FB_Reinit
-
Interface of method
FB_Exit
-
Behavior for derived function blocks