Symbol:
Interface properties are an extension of the IEC 61131-3 standard and a tool for object-oriented programming. An interface property declares
the accessor methods Get
and Set
(no implementation code). Therefore, a function block that implements an interface
also inherits their interface properties.
You can add an interface property to the device tree for an interface. Then an interface
is extended with the accessor methods Get
and Set
. The Get
accessor is for read access. The Set
accessor is for write access. You can delete an unneeded accessor. Click “Project Add Object Interface Property” to add an accessor. The “Add Interface Property” dialog opens.
Example
Declaration and implementation of the interface property Literal_A


This interface itf_A
has the property Literal_A
with the accessor methods Get
and Set
.
The function blocks fb_A1
and fb_A2
implement the interface itf_A
and therefore inherit its interface property. Each FB has its own implementation.
Interface itf_A
INTERFACE itf_A VAR END_VAR PROPERTY Literal_A : STRING
FB fb_A1
FUNCTION_BLOCK fb_A1 IMPLEMENTS itf_A VAR str_1 : STRING; str_2 : STRING; iCnt : INT; END_VAR iCnt := iCnt + 1; str_1 := 'Function block A1';
Accessor fb_A1.Literal_A.Get
VAR END_VAR Literal_A := CONCAT (str_1,' and property.');
Accessor fb_A1.Literal_A.Set
VAR END_VAR str_2 := Literal_A;
FB fb_A2
FUNCTION_BLOCK fb_A2 IMPLEMENTS itf_A VAR str_1 : STRING; str_2 : STRING; iCnt : INT; END_VAR iCnt := iCnt + 1; str_1 := 'Function block A2';
Accessor fb_A2.Literal_A.Get
VAR END_VAR Literal_A := str_1;
Accessor fb_A2.Literal_A.Set
VAR END_VAR str_2 := Literal_A;
Program PLC_PRG
PROGRAM PLC_PRG VAR iCnt : INT; my_1 : fb_A1; my_2 : fb_A2; strName_1 : STRING; strName_2: STRING; END_VAR iCnt := iCnt + 1; my_1(); my_2(); strName_1:= my_1.Literal_A; strName_2:= my_2.Literal_A; my_1.Literal_A := 'Hello 1'; my_2.Literal_A := 'World 2';
This leads to the following monitoring of PLC_PRG
when the application is in runtime mode:
