Menu

Formation of Modbus TCP/IP packet and sending via Modbus RTU

2017-07-24
2017-08-13
  • Kirill Rudenko

    Kirill Rudenko - 2017-07-24

    Hi! I apologize in advance for bad English. I really liked your library. It is easy and convenient to use. But we had a small problem. We have PLC1 and PLC2, which communicate with each other via Modbus TCP. And we have a PC that is connected to PLC1 and exchanges via USB by emulating the COM port. On the PLC1 side, an end-to-end exchange is made from USB to TCP. Therefore, we need to send over the USB connection via this communication channel (between PC and PLC1) Modbus TCP/IP packets and then PLC1 will transfer this packet further for PLC2. And the PC should also accept a Modbus TCP/IP packet from PLC1. Is it possible to add functionality to the library that implements this communication?

    Thank you.

     
    • Rossmann Engineering

      Hi,

      I am not sure if I understood. You would like to send a Moddbus TCP Packet over a COM-Port? Is that what are asking for?
      Modbus RTU is specified for a data exchange using serial connection. Couldn't you use Modbus RTU?

      Stefan

       
  • Anonymous

    Anonymous - 2017-08-03

    Hello,

    Very nice work on the library! Is it possible to get the IP-address of the connected client when using your ModbusServer? I have > 256 connecting ModbusTCP client and would like to use ip-addresses to identify client instead of their station-ids

    Regards

     
    • Rossmann Engineering

      Hi,

      its not possible at the moment, but its a good point! Will add that soon.

       
  • Kirill Rudenko

    Kirill Rudenko - 2017-08-11

    Hi!
    "You would like to send a Moddbus TCP Packet over a COM-Port? Is that what are asking for?" - yes, yoa are right.
    But now we talked to the developer and agreed to redo the exchange according to the standard.

    Also, I noticed one problem in your library. If you first initialize ModbusClient modbusClient = new ModbusClient (); Without passing a parameter with the name of the COM port and then specify it modbusClient.SerialPort = "COM1"; Then an error occurs when connecting -
      System.UnauthorizedAccessException: "Access to the port 'COM1' is closed."
    Any ideas?

    Anyway, thank you for your library.

     
    • Rossmann Engineering

      Hi,

      at the moment you have to define the Serial Port in using the correct constructor.

      ModbusClient modbusClient = new ModbusClient ("COM1");

      But you are right that we could initialize the COM Port also as soon as the Property SerialPort changes. I will fix that in the new version.

      Right now you have to use the correct constructor to initialize the Serial port.

       

Anonymous
Anonymous

Add attachments
Cancel