Declaring properties at start-up

In normal PLC programming you will probably find calls like this:

Declaring properties at start-up 1:

If the values are constantly written by the PLC, writing from the BACnet would have no effect, the values would be overwritten immediately. Therefore, especially the properties that do not change often or at all should be declared as initial parameters in the variable area. The following code shows an example of initialization of properties at the time of the first PLC start.

PROGRAM test
VAR
       fbBI    :    FB_BACnet_BI    := (
                                 sObjectName := 'Name',
                                 sDescription := 'Description',
                                 bEventDetectionEnable := TRUE
                                                               );
       bDescriptionChanged          :     BOOL;
END_VAR


--------------

fbBI();
IF bDescriptionChanged THEN
       bDescriptionChanged := FALSE;
       fbBI.sDescription := 'New Description';
END_IF

In the above example, the property values (only those that require configuration) are taken from the declaration at the time of the first PLC start. If a configuration property needs to be changed, we recommend a write-on-change procedure, as shown here, rather than cyclic writing. Furthermore, the implementation of a cyclic writing would lead to the fact that no more values are accepted that were written by BACnet.