MODBUS TCP Ethernet Communication
Jump to navigation Jump to search
What You Need to Know Before Design
- TCP SOCKET BLOCK
- MODBUS TCP SLAVE
- MODBUS TCP MASTER
- REAL TIME PULSE GENERATOR
- MODBUS WORD READER
- LOCAL IP
- Adding a Line Label
- 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.
- 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.