5 Implementation of Modbus TCP
5.1 Common Modbus description
50
XI/ON: XNE-GWBR-2ETH-MB
10/2011 MN05002008Z-EN
www.eaton.com
5.1.1
Protocol description
The Modbus protocol defines a simple protocol data unit (PDU) independent of the underlying
communication layers.
The mapping of Modbus protocol on specific buses or networks can introduce some additional
fields on the application data unit (ADU).
The Modbus application data unit is built by the client that initiates a Modbus transaction.
The function code indicates to the server what kind of action to perform. The Modbus appli-
cation protocol establishes the format of a request initiated by a client.
The function code field of a Modbus data unit is coded in one byte. Valid codes are in the range
of 1…255 decimal (128…255 reserved for exception responses).
When a message is sent from a Client to a Server device the function code field tells the
server what kind of action to perform. Function code "0" is not valid.
Sub-function codes are added to some function codes to define multiple actions.
The data field of messages sent from a client to server devices contains additional information
that the server uses to take the action defined by the function code. This can include items
like discrete and register addresses, the quantity of items to be handled, and the count of
actual data bytes in the field.
The data field may be nonexistent (of zero length) in certain kinds of requests, in this case the
server does not require any additional information. The function code alone specifies the
action.
If no error occurs related to the Modbus function requested in a properly received Modbus
ADU the data field of a response from a server to a client contains the data requested.
Figure 33:
Modbus tele-
gram acc. to
Modbus-IDA
Figure 34:
Modbus data
transmission
(acc. to Mod-
bus-IDA)