Date: Tue, 19 Mar 2024 07:55:25 +0000 (UTC) Message-ID: <1138564428.23.1710834925438@047c447849b1> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_22_382812405.1710834925436" ------=_Part_22_382812405.1710834925436 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
The BACnet server from the FAQ BACnet: Cyclic Reading of a Property is used = as the server here.
Reduce this one to reading the analog value.
Check that the following entries are present in the file CODESYSControl.cfg.
Edit the PLC_PRG POU as follows:
Declaration
VAR fbWriteProperty : BACnet.BACnetClientWriteProperty; writePropVal : BACnet.CmpBACnet.IEC_BACNET_REAL :=3D 16.34; writePropCont : BACnet.CmpBACnet.IEC_BACNET_PROPERTY_CONTENTS; xWriteExecute : BOOL; writePrio : CmpBACnet.IEC_BACNET_SIGNED :=3D 16; xInitDone : BOOL :=3D FALSE; END_VAR
Implementation
IF NOT = xInitDone THEN fbWriteProperty.RegisterToServer(BACnet_Client); fbWriteProperty(dwTargetDeviceNumber :=3D 718, objType :=3D BACnet.CmpBACnet.IEC_BACNET_OBJECT_TYPE.OB= J_ANALOG_VALUE, objInst :=3D 1, propID :=3D BACnet.CmpBACnet.IEC_BACNET_PROPERTY_ID.PRO= P_PRESENT_VALUE); xInitDone :=3D TRUE; =20 ELSE =09writePropCont.buffer.pBuffer :=3D ADR(writePropVal); writePropCont.buffer.nBufferSize :=3D SIZEOF(writePropVal); writePropCont.nElements :=3D 1; writePropCont.tag :=3D BACnet.CmpBACnet.IEC_BACNET_DATA_TYPE.DATA_TYPE_= REAL; fbWriteProperty(xExecute :=3D xWriteExecute, propertyContents :=3D writePropCont, nWritePriority :=3D writePrio);=20 END_IF
Download the project to the controller and set the xWriteExecute variable to TRUE.
The value is transferred to the se=
rver.
The PresentValue prope= rty is written with priorities from 1 to 16, where 16 is the lowest.
When you write a value with a higher priority to the server, it is retai= ned until it is deleted or overwritten by an even higher priority.
During the delete operation, the value of the highest set priority is th= en output as PresentValue.
A priority is deleted by writing to it with the data type DATA_TYPE_NULL.