...
- Create a "Standard project" and select "CODESYS Control Win V3" as the device.
- Define the target system by means of the network scan (see BACnet server).
- Insert a "BACnet Server" object and rename it to "BACnet_Client"
Adapt the "PLC_PRG" POU POU as follows:
Section Column width 7 Declaration
Column width 93 VAR
fbReadProperty : BACnet.BACnetClientReadProperty;
xReadExecute : BOOL;
lrReadValue : LREAL;
xInitDone : BOOL := FALSE;
END_VARSection Column width 7 Declaration
Column width 93 Code Block theme Confluence VAR fbReadProperty : BACnet.BACnetClientReadProperty; xReadExecute : BOOL; lrReadValue : LREAL; xInitDone : BOOL := FALSE; END_VAR
Section Column width 7 Implementation
Column width 93 Code Block theme Confluence IF NOT xInitDone THEN fbReadProperty.RegisterToServer(BACnet_Client); fbReadProperty(dwTargetDeviceNumber := 718, objType := BACnet.CmpBACnet.IEC_BACNET_OBJECT_TYPE.OBJ_ANALOG_VALUE, objInst := 1, propID := BACnet.CmpBACnet.IEC_BACNET_PROPERTY_ID.PROP_PRESENT_VALUE); xInitDone := TRUE; ELSE fbReadProperty(xExecute := xReadExecute); IF fbReadProperty.xDone THEN xReadExecute := FALSE; lrReadValue := BACnet.GetRealFromContents(fbReadProperty.result); END_IF END_IF
...