Example FB_BACnetRM_WriteProperty
This example shows how to use the function block FB_BACnetRM_WriteProperty to write the value of the out_of_service property of the object binary output, instance number 0 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 := 42,tReadCycleTime:=T#10S,nMaxParallelRequests:=255);
fbDevice : FB_BACnetRM_Device := (Client:=fbClient);
fbBO : FB_BACnetRM_BO := (Client:=fbClient,nObjectInstance:=0);
fbWrite : FB_BACnetRM_WriteProperty := (Client := fbClient);
bWriteOoS : BOOL;
bOutofService : BOOL;
END_VAR
------------------------------------------------------------------
fbClient();
fbDevice();
fbBO();
// Write OutOfService using FB_BACnetRM_WriteProperty
fbWrite.bExecute := bWriteOoS;
IF fbWrite.bExecute THEN
bWriteOoS := FALSE;
fbWrite.pData:= ADR( bOutOfService );
fbWrite.nData:= SIZEOF( bOutOfService );
fbWrite.ePropID:= E_BACnet_PropertyIdentifier.PropOutOfService;
fbWrite.iObject := fbBO;
END_IF
fbWrite();