
MODBUS TCP PROTOCOL DESCRIPTION 4-1
4.0 MODBUS TCP PROTOCAL
DESCRIPTION
This section describes the general form of
encapsulation of Modbus request and response when
carried on the Ethernet network. It is important to
note that the structure of the request and response
body, from the slave address to the end of the data
portion, have exactly the same way out and meaning
as in the other Modbus variants.
4.1 Ethernet Frame
Figure 4.1 Ethernet Frame
The above figure shows an Ethernet frame. The
message framing is encapsulated into the application
data of the Ethernet frame.
4.2 Modbus TCP Message Framing
TRANSACTION
IDENTIFIER
PROTOCOL
IDENTIFIER
LENGTH
FIELD
SLAVE ADDRESS
UNIT
IDENTIFIER
FUNCTION
DATA
2x8 BITS
16 BITS
2x8 BITS
16 BITS
2x8 BITS
16 BITS
8
BITS 8 BITS
NX8BITS
Figure 4.2 Encapsulation of Modbus RTU Frame in
Ethernet Frame as Modbus TCP
The Modbus RTU frame request and responses as
Modbus TCP message framing is inserted into
application data location. The Modbus RTU message
frame start, stop, and cRC are not included into the
Modbus TCP frame. A Modbus TCP header is added
and the slave address is replaced by a unit identifier.
The unit identifier is considered part of the header.
4.3 Modbus TCP Header Description
The Modbus TCP Header contains the following
fields:
Fields
Length Description
Client
Server
Contents
Byte 0
U s u a l l y
0
Transaction
Identifier
2 Bytes
Identification of a MODBUS
Request / Response
transaction
Initialized by
the client
Recopied by the
server from the
received request
Byte 1
U s u a l l y
0
Byte 2
0
Protocol
Identifier
2 Bytes 0 = MODBUS protocol
Initialized by
the client
Recopied by the
server from the
received request
Byte 3
0
Byte 4
0
Length
2 Bytes Number of following bytes
Initialized by
the client
(request)
Initialized by the
server
(Response)
Byte 5
N u m b e r
of Bytes
Unit
Identifier
1 Byte
Identification of a remote
slave connected on a serial
line or on other buses
Initialized by
the client
Recopied by the
server from the
received request
The header is 6 bytes long:
•
Transaction Identifier – It is used for
transaction pairing, the Modbus server copies in
the response the transaction identifier of the
request.
•
Protocol Identifier – It is used for intra-system
multiplexing. The Modbus protocol is identified
by the value 0.
•
Length – The length field is a byte count of the
Unit Identifier, Function Code, and Data Fields.
•
Unit Identifier – This field is used for intra-
system routing purpose. It is typically used to
communicate to a Modbus serial line slave
through a gateway between an Ethernet TCP/IP
network and a Modbus serial line. This field is
set by the Modbus Client in the request and must
be returned with the same value in the response
by the server.
All Modbus/TCP Message Frames are sent via TCP on
registered port 502.
Ethernet
header
IP
header
TCP
header
application data
Ethernet
trailer
20
20
14
4
Ethernet Frame
46 to 1500 bytes
MODBUS TCP HEADER
MODBUS RTU FRAME
Ethernet
header
IP
header
TCP
header
application data
Ethernet
trailer
Ethernet Frame
14
20
20
4
46 to 1500 bytes
Содержание DS Series
Страница 5: ...1 2 INTRODUCTION END OF INTRODUCTION SECTION ...
Страница 8: ...HARDWARE INTERFACE 2 3 Figure 2 3 Figure 2 2 Figure 2 1 ...
Страница 13: ...2 8 HARDWARE INTERFACE END OF HARDWARE INTERFACE ...
Страница 19: ...3 6 MODBUS RTV PROTOCAL DESCRIPTION END OF MODBUS RTU PROTOCAL DESCRIPTION ...
Страница 23: ...5 2 MODBUS FUNCTION FORMATS END OF MODBUS FUNCTION FORMATS ...
Страница 29: ...6 6 PHOENIX AC DRIVE FUNCTION FORMATS END OF PHOENIX AC DRIVE FUNCTION FORMATS ...
Страница 31: ...7 2 EXCEPTION RESPONSE END OF EXCEPTION RESPONSE ...
Страница 37: ...9 2 PARAMETER CONVERSION END OF PARAMETER CONVERSION ...
Страница 43: ...A 6 APPENDIX BASIC TCP IP DESCRIPTION THIS PAGE INTENTIONALLY LEFT BLANK ...