beautypg.com

Extensible functions - params, Fb_init, fb_reinit methods, L-force | plc designer – Lenze PLC Designer PLC Designer (R3-1) User Manual

Page 985

background image

L-force | PLC Designer

Programming Reference

DMS 4.1 EN 03/2011 TD29

983

16.1.23

Extensible Functions - PARAMS
(not yet implemented)
As an extension to the IEC 61131-3 standard it is possible to declare functions or
methods with a variable number of input parameters of the same type.
Syntax:
: = : PARAMS OF

Example:

FUNCTION funHelp : INT
VAR_INPUT
pint : PARAMS OF ;
END_VAR

Implicitly pint points to a structure containing the components Count of type INT and
Params of type POINTER TO .
When calling funHelp it is either possible to pass an array of arbitrary length of type
, or a variable number of -expressions, or mix both.
Example:

x := funHelp(1, 2, 3);
y := funHelp(intArray);
z := funHelp(1, intArray, 2);

A function may only contain one PARAMS-input, and this input must be the last input
of the function. There is no syntax for explicitly assigning an PARAMS-input within the
function call.

16.1.24

FB_init, FB_reinit Methods
FB_init
The method "FB_init" replaces the INI operator used in »PLC Designer« V2.3. It is a
special method for a function block which can be declared explicitly but also and in any
case is available implicitly. Thus in any case it can be accessed for each function block.
The init method contains initialization code for the function block as declared in the
declaration part of the function block. If the init method is declared explicitly, the
implicit initialization code will be inserted into this method. The programmer can add
further initialization code.

Note: When execution reaches the user defined initialization code, the function
block is already fully initialized via the implicit initialization code.

The init method is called after download all for each declared instance. Attention: In
online change the previous values will overwrite the initialization values!