Communicating two PLCs via GPRS
Jump to navigation Jump to search
What You Need to Know Before Design
- TCP SOCKET
- MODBUS TCP MASTER
- MODBUS TCP SLAVE
- SYMETRIC PULSE GENERATOR
- WORD REGISTER
- MODBUS WORD READER
- GPRS APN
- GPRS IP
- 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.
- GSM 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 adress is 4000, MODBUS address is set to 4000 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 GPRSIP and LISTENPORT commands.
- You also need to check APN, CSQ and GPRSIP values on Mikroterminal. Please see MODBUS TCP GSM Communication example for connection settings.