Fb_exit method, L-force | plc designer – Lenze PLC Designer PLC Designer (R3-1) User Manual

Page 987

Advertising
background image

L-force | PLC Designer

Programming Reference

DMS 4.1 EN 03/2011 TD29

985

FB_reinit
If a method named "FB_reinit" is declared for a function block instance, this method
will be called when the instance gets copied (which for example is the case at an
online change after a modification of the function block declaration). The method will
cause a reinitialization of the new instance module that has been created by the copy
code. An reinitialization might be desired because the data of the original instance will
be written to the new instance after the copying, but you might want to get the
original init values. The FB_reinit method has no inputs. Regard that in contrast to
FB_init the method must be declared explicitly. If a reinitialization of the basic
function block implementation is desired, FB_reinit must be explicitly called for that
POU.
The FB_reinit method has no inputs.
On the call sequence in case of inheritance please see: FB_exit, Execution order

16.1.25

FB_Exit Method
A special method for a function block is a method named "FB_Exit". It must be declared
explicitly, there is no implicit declaration. The exit method - if present - is called for all
declared instances of the function block before a new download, at a reset or during
online change for all moved or deleted instances.
Interface of the exit method: There is only one mandatory parameter:

METHOD fb_exit : BOOL
VAR_INPUT
bInCopyCode : BOOL; // if TRUE, the exit method is called for exiting an instance
that is copied afterwards (online change).
END_VAR


Regard also the "FB_init" method and the following execution order:

1.

exit method: exit old instance: old_inst.fb_exit(bInCopyCode := TRUE);

2.

init method: init new instance: new_inst.fb_init(bInitRetains := FALSE,
bInCopyCode := TRUE);

3.

copy function block values (copy code): copy_fub(&old_inst, &new_inst);

Advertising