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

Page 992

Advertising
background image

L-force | PLC Designer

Programming Reference

990

DMS 4.1 EN 03/2011 TD29

An userdefined attribute can be assigned to the following objects:
• POUs, Actions Example
Attribute "vision" for function fun1:

{attribute 'vision'}
FUNCTION fun1 : INT
VAR_INPUT
i : INT;
END_VAR
VAR
END_VAR

• Variables Example
Attribute "DoCount" for variable ivar is added :

PROGRAM PLC_PRG
VAR
ivar:INT; {attribute 'DoCount'};
bvar:BOOL;
END_VAR

• Types Example
Attribute "aType" for data type DUT_1 is added :

{attribute 'aType'}
TYPE DUT_1 :
STRUCT
a:INT;
b:BOOL;
END_STRUCT
END_TYPE

Attribute call_after_init
With the help of the pragma {attribute call_after_init} a method can be defined that
should be called implicitly after the initialization of a function block instance. For this
purpose the attribute must be attached both to the function block itself and to the
instance method to be called (for performance reasons). The method must be called
after FB_Init and after having applied the variable values of an initialization expression
in the instance declaration.
This functionality is supported as from compiler version >= 3.4.1.0.

Advertising