Modbus Messaging and TCP Port 502
has been the standard for serial link protocols in industry since 1979. Millions of automation devices use for communications. For , the TCP port 502 is reserved for Modbus.
Therefore, Modbus messaging can be used for exchanging automation data on both Ethernet TCP/IP and the Internet, as well as for all other applications (file exchange, Web pages, E-mail, etc.). The simple structure of Modbus allows you to download the specifications and source code for numerous devices that use the Modbus TCP/IP protocol. These items are available free of charge from the Modbus-IDA Web site (www.modbus-ida.org).
messaging paths:
-
server path:
-
Port 502 messaging can process up to 8 incoming requests from the network. Requests are received during the previous scan and sent to the Modbus server in the IN section.
-
Port 502 messaging can process up to 8 responses from the Modbus server in the IN section (including writing the data into the socket).
-
client path:
-
Port 502 messaging can process up to 16 outgoing requests from the application in the OUT section (including writing the data into the socket).
-
Port 502 messaging can process up to 16 incoming responses from the network in the IN section. Responses are sent to the application.
This service enables communications through the Modbus protocol between a Modicon M340 and:
The following figure shows the Modbus communications over open TCP/IP connections:
1
Modicon M340 PLC (1)
2
Modicon M340 PLC (2)
3
Modbus protocol
4
Quantum server/client
5
client supervisor
6
TCP/IP Ethernet
The same module can communicate with a remote device in client mode (for example a Quantum PLC) and another remote device in server mode (for example a supervisor PC).
In the above figure, Modicon M340 PLC (1) is the client to the Quantum PLC. It opens the TCP/IP connection and sends Modbus messages to the Quantum. Modicon M340 PLC (2) is the server to the supervisor. The supervisor has opened a TCP/IP connection for sending Modbus messages to Modicon M340 PLC (2).
The following requests are addressed to the device on which you want to perform variable read or write operations:
Modbus Requests
|
Function Code (Hexadecimal)
|
Communication Function
|
Read bits
|
16#01
|
READ_VAR
|
Read input bits
|
16#02
|
READ_VAR
|
Read words
|
16#03
|
READ_VAR
|
Write a bit or n bits
|
16#0F
|
WRITE_VAR
|
Write a word or n words
|
16#10
|
WRITE_VAR
|
NOTE: The timeout value for READ_VAR is user-configurable as follows:
-
If you enter a 0 as the timeout value, the block will never timeout.
-
If you enter a non-zero value, the block will timeout at the non-zero value you entered.
Correspondence of Object Types
This table describes object type correspondence between a Modicon M340 PLC and a Momentum, Quantum, or Premium PLC:
Modicon M340 Objects
|
Quantum or Momentum Objects
|
: internal words
|
4x... memory area
|
: internal bits
|
0x... memory area
|
: input words
|
3x... memory area
|
: input bits
|
1x... memory area
|