Transfer of the reference to the communication block

The individual function blocks of the Tc3_DALI send and receive the DALI data packets via the respective DALI terminal (KL6811, KL6821 or EL6821). The function blocks access the DALI terminal via a special communication block (FB_KL6811Communication, FB_KL6821Communication or FB_EL6821Communication). Each instance of a communication block is assigned to exactly one DALI terminal.

The communication blocks ensure that the processing of the individual DALI commands is carried out correctly and that the received events are assigned to the correct function blocks.

Each function block requires a reference to a communication block. This assignment is implemented in the Tc3_DALI with an interface pointer. There are two ways to pass the assignment of the communication block to a function block.

Transfer during declaration

When declaring the function block, the complete path of the instance of the communication block (FB_KL6811Communication, FB_KL6821Communication or FB_EL6821Communication) is specified in round brackets.

fbDALI102Off : FB_DALI102Off(Communication.fbKL6821Communication);

The complete path consists of the POU name in which the instance of the communication block was created (Communication) and the name of the instance (fbKL6821Communication), separated by a dot.

If no communication block is to be passed in the declaration, a zero reference can be passed by a '0'.

fbDALI102Off : FB_DALI102Off(0);

This can be useful if an assignment is to be made only at program runtime (see below).

If a module does not have a valid interface pointer to a communication block, a runtime message is output.

Transfer of the reference to the communication block 1:

If the interface pointer is changed in the declaration, this is not taken into account during an Online Change. In this case, the PLC program must be completely recompiled and loaded onto the target system.

Use of arrays

Each instance can be assigned to an individual communication block. The instances of the communication blocks can also map different types of DALI terminals (KL6811, KL6821 or EL6821).

aDALI102Off : ARRAY[1..3] OF FB_DALI102Off[(Communication.fbKL6821Communication),
                                           (Communication.fbEL6821Communication),
                                           (Communication.fbKL6811Communication)];

In the following sample, all instances are assigned to the same communication block:

aDALI102Off : ARRAY[1..3] OF FB_DALI102Off(Communication.fbKL6821Communication);

Transfer by property

So that the reference to the communication block can also be changed at runtime, all function blocks have the property ipDALICommunication. This property can also be used to pass the interface pointer.

fbDALI102Off.ipDALICommunication := Communication.fbKL6821Communication01;

The assignment does not have to take place in every PLC cycle. It is sufficient if this is done once.

IF (bSwitchToLinie01) THEN
   fbDALI102Off.ipDALICommunication := Communication.fbKL6821Communication01;
   bSwitchToLinie01 := FALSE;
END_IF
IF (bSwitchToLinie02) THEN
   fbDALI102Off.ipDALICommunication := Communication.fbKL6821Communication02;
   bSwitchToLinie02 := FALSE;
END_IF

For additional information on properties, see the chapter Use op properties.