Example FB_BACnetRM_ReadProperty
This sample shows how to use the FB_BACnetRM_ReadProperty
function block to read the value of the high_limit property from the analog input object, instance number 1 in the peer device instance number 42. Please note that the object referenced by iObject must be called cyclically.
VAR
fbClient : FB_BACnet_Client := (nDeviceInstance := 2,tReadCycleTime:=T#10S,nMaxParallelRequests:=255);
fbDevice : FB_BACnetRM_Device := (Client:=fbClient);
fbAI : FB_BACnetRM_AI := (Client:=fbClient,nObjectInstance:=1);
fbRead : FB_BACnetRM_ReadProperty := (Client := fbClient);
bReadHighLimit : BOOL;
fHighLimit : REAL;
END_VAR
------------------------------------------------------------------
fbClient();
fbDevice();
fbAI();
// Read HighLimit using FB_BACnetRM_ReadProperty
fbRead.bExecute := bReadHighLimit;
IF fbRead.bExecute THEN
bReadHighLimit := FALSE;
fbRead.pData:= ADR( fHighLimit );
fbRead.nData:= SIZEOF( fHighLimit );
fbRead.ePropID:= E_BACnet_PropertyIdentifier.PropHighLimit;
fbRead.iObject := fbAI;
END_IF
fbRead();