Protocol implementation – Lenze E94P PositionServo Modbus User Manual

Page 28

Advertising
background image

28

P94MOD01C

Protocol Implementation

If no error occurs related to the Modbus function requested in a properly received Modbus ADU, the data field
of a response from a slave/server to a master/client contains the data requested. If an error related to the
Modbus function requested occurs, the field contains an exception code that the server application can use to
determine the next action to be taken.

5.8.3 ADU for Modbus RTU

The ADU for Modbus RTU consists of the Address field, Error Check and the common Modbus PDU.
Address Field
As described in the previous section the valid slave nodes addresses are in the range of 0 – 247 decimal. The
individual slave devices are assigned addresses in the range of 1 to 247. A master addresses a slave by placing
the slave address in the address field of the message. When the slave returns its response, it places its own
address in the response address field to let the master know which slave is responding.
Error Check Field
Error checking field is the result of a Cyclical Redundancy Checking (CRC) calculation that is performed on the
message contents.
The CRC field checks the contents of the entire message. It is applied regardless of any parity checking method
used for the individual characters of the message.
The CRC field contains a 16–bit value implemented as two 8–bit bytes.
The CRC field is appended to the message as the last field in the message. When this is done, the low–order
byte of the field is appended first, followed by the high–order byte. The CRC high–order byte is the last byte to
be sent in the message.
The CRC value is calculated by the sending device, which appends the CRC to the message. The receiving
device recalculates a CRC during receipt of the message, and compares the calculated value to the actual value
it received in the CRC field. If the two values are not equal then it results in an error.

5.8.4 ADU for Modbus TCP

The ADU for Modbus TCP consists of the MBAP Header and the common Modbus PDU.
The MBAP header is 7 bytes long.
The actual IP addressing and message error checking are performed by the Ethernet physical layer, refer to the
ISO 7-layer model and the Modbus-IDA website for further details.

Table 10: MBAP Header

Field

Length (Bytes) Description

Client

Server

Transaction Identifier

2

Identification of a Modbus
Request/Response
transaction

Initialized by the client

Recopied by server from
received request

Protocol Identifier

2

0 = Modbus protocol

Initialized by the client

Recopied by server from
received request

Length

2

Number of following bytes

Initialized by the client
(request)

Initialized by the server
(response)

Unit Identifier

1

Identification of a remote
slave connected on a serial
line or on other buses.

Initialized by the client

Recopied by server from
received request

Table Copyright © 2005-2009 Modbus-IDA from the official Modbus Messaging Implementation Guide V1.0b

Advertising