Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • 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 as follows:




    Section
    Column
    width7

    Declaration

    Column
    width93

    VAR

    fbReadProperty : BACnet.BACnetClientReadProperty;
    xReadExecute : BOOL;
    lrReadValue : LREAL;
    xInitDone : BOOL := FALSE;
    END_VAR

    Section
    Column
    width7

    Declaration

    Column
    width93
    Code Block
    themeConfluence
    VAR
    	fbReadProperty	: BACnet.BACnetClientReadProperty;
    	xReadExecute	: BOOL;
        lrReadValue		: LREAL;
    	
    	xInitDone 		: BOOL := FALSE;
    END_VAR




    Section
    Column
    width7

    Implementation

    Column
    width93
    Code Block
    themeConfluence
    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





...