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

Page 80

Advertising
background image

L-force | PLC Designer

Concepts and Base Components

78

DMS 4.1 EN 03/2011 TD29

According to the IEC 61131-3 standard, methods like "normal" functions can have
additional outputs. Those must be assigned in the method call according to syntax
<method>(in1:=<value> |, further input assignments, out1 => <output variable 1> |
out2 => <output variable 2> | ...further output variables)
which effects that the output of the method is written to the locally declared output
variables as given within the call.

Example:
Assume that function blocks fub1 and fub2 EXTEND function block fubbase and
IMPLEMENT interface1. Method method1 is contained.
Possible use of the interfaces and method calls:

VAR_INPUT
b : BOOL;
END_VAR
VAR
pInst : POINTER TO fubbase;
instBase : fubbase;
inst1 : fub1;
inst2 : fub2;
interfaceRef : interface1;
END_VAR

IF b THEN
interfaceRef := inst1; (* Interface1 for fub1 *)
pInst := ADR(instBase);
ELSE
interfaceRef := inst2; (* Interface1 for fub2 *)
pInst := ADR(inst1);
END_IF

pInst^.method1(); (* If b is true, fubbase.method1 is called, else fub1.method1 is
called *)
interfaceRef.method1(); (* If b is true, fub1.method1 is called, else fub2.method1 is
called *)

Advertising