User manual
Page 144 Modbus Protocol – PAT700 Total Organic Carbon Analyzer
Operator Manual Anatel
11.2 Modbus/TCP Driver
Modbus Protocol
A typical Modbus/TCP frame consists of the following fields:
The MBAP Header (Modbus Application Protocol Header) consists of 7 bytes of information:
The Function Code field of a message contains 8 bits. Valid function codes are in the range
of 1 - 255 decimal. The function code instructs the slave what kind of action to take. The
Modbus/TCP feature only supports Function Codes: FC3 (Read Multiple Registers) and FC6
(Preset Single Register). The 125-register limitation is established for the Modbus/TCP
standard to maintain consistency with original Modbus protocol standard, even though a TCP/
IP packet can support more data.
When a slave responds to the master, it uses the function code field to indicate either a normal
response or that some type of error has occurred. For a normal response, the slave echoes
the original function code. In an error condition, the slave echoes the original function code
with its MSB set to logic 1.
The Data field is constructed using sets of two hexadecimal digits in the range of 00 to FF.
According to the network's serial transmission mode, these digits can be made of a pair of
ASCII characters or from one RTU character. The data field also contains additional
information that the slave uses to execute the action defined by the function code. This can
include internal addresses, quantity of items to be handled, etc.
The data field of a response from a slave to a master contains the data requested if no error
occurs. If an error occurs, the field contains an exception code that the master uses to
determine the next action to be taken. The data field can be nonexistent in certain types of
messages.
MBAP Header Function Data
Transaction Identifier 2 bytes
It is used for transaction pairing i.e. identification of Request/
Response transaction. The Modbus/TCP server copies the
transaction identifier of the request in to the response.
Protocol Identifier 2 bytes
It is used for intra-system multiplexing. The Modbus/TCP
protocol is identified by the value 0.
Length 2 bytes
The length field is a byte count of the following fields, including
the Unit Identifier.
Unit Identifier 1 byte
This field is used for intra-system routing purpose. It is typically
used to communicate to a MODBUS or 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.