Modbus Messaging on TCP
Modbus Messaging on TCP
[edit]
Modbus TCP
[edit]
Modbus TCP nomenclature is the same as for the Modbus over Serial line
protocol, as any device which send out a Modbus command, is the 'client'
and the response comes from a 'server'.[29]
The ADU for Modbus TCP is officially called Modbus TCP/IP ADU by the
Modbus organization[30] and is also called Modbus TCP frame by other parties.
[3]
Where MBAP - which stands for MODBUS Application Protocol header - is the
dedicated header used on TCP/IP to identify the MODBUS Application Data
Unit.
Length
Name Function
(bytes)
Protocol
2 0 for Modbus/TCP
identifier
Unit identifier is used with Modbus TCP devices that are composites of
several Modbus devices, e.g. Modbus TCP to Modbus RTU gateways. In such a
case, the unit identifier is the Server Address of the device behind the
gateway.
A MODBUS TCP/IP ADU/Modbus TCP frame format then will be:[31][30]
2 n
2 bytes 2 bytes 1 byte 1 byte
bytes bytes
[edit]
12 34 00 00 00 06 01 03 00 01 00 01
0x00 and 0x00 : Protocol identifier high byte and low byte
0x00 and 0x06 : Length high byte and low byte. The length is 6 bytes
which includes: unit identifier (slave address) (1 byte), function code (1
byte), high byte of the register address to read (1 byte), low byte of the
register address to read (1 byte) and data (2 bytes = high byte and low
byte of the number of registers to read)
0x00 and 0x01 : high byte and low byte of the register address to read.
The register address to read in this case is 0x0001.
0x00 and 0x01 : high byte and low byte of the number of registers to
read. The number of registers to read in this case is 0x0001. (i.e 1
register)
[edit]
[edit]
Besides the widely used Modbus RTU, Modbus ASCII and Modbus TCP, there
are many variants of Modbus protocols:
Data models and function calls are identical for the first four variants listed
above; only the encapsulation is different. However the variants are not
interoperable, nor are the frame formats.
JBUS mapping
[edit]
Another de facto protocol closely related to Modbus appeared later, and was
defined by PLC maker April Automates, the result of a collaborative effort
between French companies Renault Automation and Merlin Gerin et Cie in
1985: JBUS. Differences between Modbus and JBUS at that time (number of
entities, server stations) are now irrelevant as this protocol almost
disappeared with the April PLC series, which AEG Schneider Automation
bought in 1994 and then made obsolete. However, the name JBUS has
survived to some extent.
JBUS supports function codes 1, 2, 3, 4, 5, 6, 15, and 16 and thus all the
entities described above, although numbering is different:
Consequently, entity number does not include the entity type. For
example, holding register #40010 in Modbus will be holding register
#9, at address 9 in JBUS.
Number 0 (and thus address 0) is not supported. The server should not
implement any real data at this number and address, and it can return
a null value or throw an error when requested.
Limitations
[edit]