3 data link layer, 4 data link layer – GE Industrial Solutions Entellisys 4.0 Integrator's Guide User Manual

Page 28

Advertising
background image

Modbus® protocol implementation

28

22

2.3 Data link layer

Communications takes place in packets, which are groups of asynchronously framed byte data.
The master transmits a packet to the slave and the slave responds with a packet. The end of a
packet is marked by ‘dead-time’ on the communications line. The following describes general
format for both transmit and receive packets. For exact details on packet formatting, see the
subsequent sections describing each function code.

MODBUS PACKET FORMAT

SLAVE ADDRESS
This is the address of the slave device that is intended to receive the packet sent by the master
and perform the desired action. Only the addressed slave will respond to a packet that starts
with its address. Note that since Modbus/TCP also relies on a correct IP address to receive the
packet, and each CPU responds as a single device, it is generally not necessary to change the
Modbus address of the device.

FUNCTION CODE
This is one of the supported function codes of the unit which tells the slave what action to
perform. See

Supported function codes on page 30

for complete details. An exception response

from the slave is indicated by setting the high order bit of the function code in the response
packet. See

Exception responses on page 35

for further details.

DATA
This will be a variable number of bytes depending on the function code. This may include actual
values, settings, or addresses sent by the master to the slave or by the slave to the master.

CRC
This is a two byte error checking code. The RTU version of Modbus includes a 16-bit cyclic
redundancy check (CRC-16) with every packet which is an industry standard method used for
error detection. If a Modbus slave device receives a packet in which an error is indicated by the
CRC, the slave device will not act upon or respond to the packet thus preventing any erroneous
operations. See

CRC-16 Algorithm on page 29

for a description of how to calculate the CRC.

DESCRIPTION

SIZE

SLAVE ADDRESS

1 byte

FUNCTION CODE

1 byte

DATA

N bytes

CRC

2 bytes

DEAD TIME

3.5 bytes transmission time

Advertising