Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Modbus FB - ModbusRequest

Anonymous
2018-02-07
2018-03-20
  • Anonymous - 2018-02-07

    Originally created by: ph0010421

    I'd like to use the ModbusRequest FB. One of the inputs is the RTS_IEC_HANDLE.
    Which function/method will return this handle for me?
    thanks

     
  • bjh - 2018-03-19

    I had to open the COM port first using the SysCom library - this returns the RTS_IEC_HANDLE for the port to pass into the ModbusRequest block.

    There is very, very little documentation on this...

    VAR
       modbusRequestSerial: IoDrvModbus.ModbusRequest2;
       modbusCommandSerial : IoDrvModbus.ModbusCommand;
       comm : IoDrvModbus.RTS_IEC_HANDLE;
       commSettings : SysCom.COM_Settings;
       pntResult : POINTER TO SysCom.RTS_IEC_RESULT;
    END_VAR
                      comm := SysCom.SysComOpen2(pSettings := ADR(commSettings),0, pResult:=pntResult);
                      modbusRequestSerial(
                         xExecute:= xExecute, 
                         xAbort:= , 
                         hComPort:= comm, 
                         usiSlaveAddr:= 32, 
                         modbusCommand:= modbusCommandSerial, 
                         tResponseTimeout:= , 
                         uiSendTimeout:= , 
                         pSendData:= ADR(servoOpcode), 
                         pRecvData:= , 
                         transmission:= , 
                         xDone=> xDone, 
                         xBusy=> , 
                         xError=> xError, 
                         xAborted=> , 
                         uiDataLength=> , 
                         byModbusError=> );
    
     
  • Anonymous - 2018-03-20

    Originally created by: ph0010421

    thank you

     

Log in to post a comment.