This wiki has no edits or logs made within the last 45 days, therefore it is marked as inactive. If you would like to prevent this wiki from being closed, please start showing signs of activity here. If there are no signs of this wiki being used within the next 15 days, this wiki may be closed per the Dormancy Policy. This wiki will then be eligible for adoption by another user. If not adopted and still inactive 135 days from now, this wiki will become eligible for deletion. Please be sure to familiarize yourself with Miraheze's Dormancy Policy. If you are a bureaucrat, you can go to Special:ManageWiki and uncheck "inactive" yourself. If you have any other questions or concerns, please don't hesitate to ask at Stewards' noticeboard.

MODBUS TCP Ethernet Communication

From Mikrodev Documentation
Jump to navigation Jump to search
Download Project Files

What You Need to Know Before Design

Diagram Algorithm

  • The PLC configured as MODBUS Master will read a register value from the PLC configured as MODBUS Slave. In MODBUS protocol a SLAVE device creates a "TCP Server Socket", however the MASTER device creates "TCP Client Socket". The MASTER device connects the SLAVE device. So the MASTER should know about the IP and PORT information of the SLAVE device.

Diagram Solution

Master Device:


Slave Device:


  • Two devices and two separate diagrams are used as server and client.
  • Ethernet is selected as the media type in the TCP Socket Block.
  • Modbus TCP slave block is used in server diagram. This allows the client device to connect to the server. By specifying the ID, more than one device will be able to operate as a slave. In the TCP socket block, the server is selected and the listening port is entered.
  • The MODBUS TCP MASTER block is added on the client diagram to connect to the SLAVE device. Each time the rising edge of the MODBUS word reader block arrives at the trigger input, the specified register is read from the device it is connected to. The ID of the device identified as a slave should be written in the "ID" definition field in the MODBUS word reader block.
  • Since the MODBUS register address of Word Register Block with modbus address is 4004, MODBUS address is set to 4004 in to Modbus Word Reader Block. In the TCP socket of the client device, the IP number of the PLC to be connected and the listening port values are entered. The SLAVE device's IP and listening port values can be learned on the Mikroteminal application console with LOCALIP command.
  • From inside of TCP socket block "TCP server " selecting 502 was written as listening port.Was not write ip filter because you want to connect from any ip address. If only one from IP had to be connected, was will needed IP filter to determine.
  • You also need to check MAC, GATEWAY and NETMASK values on Mikroterminal. Please see MODBUS TCP Ethernet Communication example for connection settings.
  • Local Ip address, is specified the IP address of PLC device.
  • Local Ip setting have to configured subnet mask, default gateway parameters as using.