Extension of a function block, L-force | plc designer – Lenze PLC Designer PLC Designer (R3-1) User Manual

Page 77

Advertising
background image

L-force | PLC Designer

Concepts and Base Components

DMS 4.1 EN 03/2011 TD29

75

If the instance is inserted via input assistant (<F2>) with option With arguments in the
implementation window of a ST or IL POU, it will be displayed automatically according
to the syntax showed in the following example with all of its parameters. But you not
necessarily must assign these parameters. For the above mentioned example the call
would be displayed as follows:
Example, insert via input assistant with arguments:

CMD_TMR(in:=, pt:=, q=>)
-> fill in, e.g.:
CMD_TMR(in:=bvar, pt:=t#200ms, q=>bres);

Extension of a function block
Supporting object orientated programming a function block can be derived from
another function block. This means a function block can extend another, thus
automatically getting the properties of the basing function block in addition to its
own.
The extension is done by using the keyword EXTENDS in the declaration of a function
block. You can choose the "extends" option already during adding a function block to
the project via the Add Object dialog.
The syntax:
FUNCTION_BLOCK <function block name> EXTENDS <function block name>
This is followed by the declaration of the variables.
Example:
Definition of function block fbA:

FUNCTION_BLOCK fbA
VAR_INPUT

x:int;

....

Definition of function block fbB:

FUNCTION_BLOCK fbB EXTENDS fbA
VAR_INPUT

ivar:int;

....

Advertising