Vai al contenuto

How to use the Modbus master and slave FBs on TCP/IP

Home Forum Programmazione IEC 61131 (LogicLab) How to use the Modbus master and slave FBs on TCP/IP

Stai visualizzando 4 post - dal 1 a 4 (di 4 totali)
  • Autore
    Post
  • #35993
    Gregory
    Partecipante

    In this topic is explained the use of the ModbusMaster for RTU communication over the serial line, what about the communication on TCP/IP ?

    #39521
    Sergio Bertana
    Amministratore del forum

    The ModbusMaster FB (Manual abstract) can manage all the three Modbus protocol types (Ascii, RTU and TCP/IP), it can manages the Modbus protocol over all the communication streams, serial line (See topic), TCP or UDP. The FB has a File input to pass the stream to use.

    So use the Modbus communication over IP it’s so simply, just open a TCP/IP client communication on the device with which to communicate (By using the SysTCPClient FB) and then pass the stream to the ModbusMaster FB. This is the printout of the TCPModbusMaster program that shows what to do.

    The program reads 8 registers using the 16#03 Read Holding Registers modbus command from a SlimLine slave device (IP address 192.168.0.218) and stores the result on the RxData array. Remind that the Modbus slave on the SlimLine is directly managed by the operating system so no additional slave FB is required (Program download).

    #39526
    Gregory
    Partecipante

    The download link for “Program download” in the above topic is broken. I looked at the program printout and typed it in. I am not getting a “Connected” indication on the SysTCPClient and the “File” is 0.

    #39527
    Sergio Bertana
    Amministratore del forum

    I’ve corrected the download link.

    About the Connected output, have you corrected the PeerAdd ? To work this program has to be connected by ethernet to another SlimLine and you have to set in the PeerAdd the IP address of the other SlimLine.

Stai visualizzando 4 post - dal 1 a 4 (di 4 totali)
  • Devi essere connesso per rispondere a questo topic.