smartDEN
IP-16R-MT
User Manual
7 July 2020
-
38
-
9. Modbus TCP
Modbus-TCP is an application layer messaging protocol, which provides
master/slave (client/server) communication between devices connected on Ethernet
networks. A Modbus-TCP message consists of a header (7 bytes) and the protocol
data unit, which is encapsulated by the transmitting device into a standard TCP
frame (Figure 30).
Figure 30.
Modbus-TCP message format
The MBAP header includes the following fields:
Transaction Identifier
- used for transaction pairing when multiple messages
are sent along the same TCP connection by a client without waiting for a prior
response;
Protocol Identifier
- this field is always set to 0 for Modbus-TCP services;
Length
– number of bytes in the remaining fields (unit identifier byte, function
code byte, and data fields);
Unit Identifier
- used to identify a remote server located on a non TCP/IP
network (for serial bridging). In a typical Modbus-TCP server application, the
unit ID is set to 0;
The function code field of the message contains one byte that specifies what kind
of action the slave needs to take. When the server responds to the client, it echoes
the same function code to indicate a normal (error-free) response. If the server
cannot process a request, it will instead return an error function code (exception
response) that is the original function code plus 80h (i.e. with its most significant bit
set to 1).
Modbus-T
CP uses a „big-Endian‟ representation for addresses and data fields
(when a numerical quantity larger than a single byte is transmitted, the most
significant byte is sent first).
smartDEN IP-16R-MT
acts as a Modbus-TCP slave/server device, while a typical
master device is a host computer running appropriate application software (for
example a Raspberry Pi board running Home Assistant automation platform).
9.1.
MODBUS Commands
This following table shows the standard Modbus-TCP functions supported by the
smartDEN IP-16R-MT
module: