Data Link Layer; Crc-16 Algorithm - GE D90 Plus Communications Manual

Line distance protection system
Hide thumbs Also See for D90 Plus:
Table of Contents

Advertisement

MODBUS PROTOCOL OVERVIEW

Data link layer

CRC-16 algorithm

4
Communication takes place in packets that 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 table shows the
general format for both transmit and receive packets.
Table 1: Modbus packet format
Description
Slave address
Function code
Data
CRC
Dead time
The slave address indicates the address of the slave device intended to receive the packet
sent by the master and to perform the required action. Each slave device on a
communications bus must have a unique address to prevent bus contention. The D90
slave address is programmable from 1 to 254. Only the slave addressed responds to a
packet that starts with its address. Note that the faceplate USB port is an exception to this
rule; it acts on a message containing any slave address.
A master transmit packet with slave address 0 indicates a broadcast command. All slaves
on the communication link take action based on the packet, but none respond to the
master. Broadcast mode is only recognized when associated with function code 05h. For
any other function code, a packet with broadcast mode slave address 0 is ignored.
The function code tells the slave which action to perform. An exception response from the
slave is indicated by setting the high order bit of the function code in the response packet.
The data format is a variable number of bytes depending on the function code. This can
include actual values or addresses sent by the master to the slave or by the slave to the
master.
The CRC is a two-byte error checking code. Modbus RTU includes a 16-bit cyclic
redundancy check (CRC-16) with every packet. This 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 does not act upon or respond to the packet. This
prevents erroneous operations.
A packet is terminated when no data is received for a period of 3.5 byte transmission times
(about 15 ms at 2400 bps, 2 ms at 19200 bps, and 300 µs at 115200 bps). Consequently,
the transmitting device must not allow gaps between bytes longer than this interval. Once
the dead time has expired without a new byte transmission, all slaves start listening for a
new packet from the master except for the addressed slave.
The 16-bit cyclic redundancy check (CRC-16) algorithm treats the entire data stream (data
bits only; start, stop, and parity ignored) as one continuous binary number. This number is
shifted left 16 bits and then divided by a characteristic polynomial (11000000000000101B).
The 16-bit remainder of the division is appended to the end of the packet, MSByte first. The
resulting packet including CRC, when divided by the same polynomial at the receiver, gives
a zero remainder if no transmission errors have occurred. This algorithm requires the
characteristic polynomial to be reverse-bit ordered. The most significant bit of the
characteristic polynomial is dropped, since it does not affect the value of the remainder.
A C programming language implementation of the CRC algorithm is provided upon
request. The algorithm is as follows:
Size
1 byte
1 byte
1 or more bytes
2 bytes
3.5 bytes transmission time
PLUS
D90
LINE DISTANCE PROTECTION SYSTEM – COMMUNICATIONS GUIDE
CHAPTER 2: MODBUS COMMUNICATION
Plus

Advertisement

Table of Contents
loading

Table of Contents