<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
  <POU Name="FB_UMD705" Id="{e3557e0d-5497-476d-aba3-e3a1e4ffd057}" SpecialFunc="None">
    <Declaration><![CDATA[FUNCTION_BLOCK FB_UMD705
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR
	_xExecute : BOOL;	

	// FB for reading Modbus holding registers
	_fbReadRegister : FB_MBReadRegs;
	
	// FB for writing Modbus holding registers
	_fbWriteRegister : FB_MBWriteRegs;
	
	_diLastReset : DINT;
END_VAR
VAR CONSTANT
	STATUS_REGISTER : WORD := 40108;
END_VAR
]]></Declaration>
    <Implementation>
      <ST><![CDATA[_fbReadRegister(
	sIPAddr:= sInverterIPAddr, 
	nTCPPort:= 502, 
	nUnitID:= 16#FF, // 16#FF for Modbus TCP
	nQuantity:= 1, 
	nMBAddr:= STATUS_REGISTER, 
	cbLength:= SIZEOF(_uiInverterState), 
	pDestAddr:= ADR(_uiInverterState), 
	bExecute:= TRUE, 
	tTimeout:= T#5S, 
	bBusy=> , 
	bError=> , 
	nErrId=> , 
	cbRead=> );



IF _xExecute THEN
	_xExecute := FALSE;
END_IF]]></ST>
    </Implementation>
    <LineIds Name="FB_UMD705">
      <LineId Id="21" Count="0" />
      <LineId Id="24" Count="11" />
      <LineId Id="23" Count="0" />
      <LineId Id="22" Count="0" />
      <LineId Id="17" Count="1" />
      <LineId Id="9" Count="0" />
      <LineId Id="19" Count="1" />
    </LineIds>
  </POU>
</TcPlcObject>