0% found this document useful (0 votes)
1 views

Modbus RTU

Uploaded by

Mansoor Ali Khan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Modbus RTU

Uploaded by

Mansoor Ali Khan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Modbus RTU

[edit]

Modbus RTU (Remote Terminal Unit), which is the most common


implementation available for Modbus, makes use of a compact, binary
representation of the data for protocol communication. The RTU format
follows the commands/data with a cyclic redundancy check checksum as an
error check mechanism to ensure the reliability of data. A Modbus RTU
message must be transmitted continuously without inter-character
hesitations. Modbus messages are framed (separated) by idle (silent)
periods. Each byte (8 bits) of data is sent as 11 bits: [3][24]

 1 start bit

 8 bit data/message, least significant bit sent first

 1 bit parity

 1 stop bit

The default is even parity, while odd or no parity may be implemented as


additional options.[24]

A Modbus RTU frame then will be:[25]

Slave Function
Data CRC
address Code

0 – 252 2 bytes: 1 CRC low byte and 1


1 byte 1 byte
bytes CRC high byte

The CRC calculation is widely known as CRC-16-MODBUS, whose polynomial


is x16 + x15 + x2 + 1 (normal hexadecimal algebraic polynomial
being 8005 and reversed A001).[26]

Example of a Modbus RTU frame in hexadecimal: 01 04 02 FF FF B8 80 (CRC-


16-MODBUS calculation for the 5 bytes from 01 to FF gives 80B8, which is
transmitted least significant byte first).

To ensure frame integrity during the transmission, the time interval between
two frames must be at least the transmission time of 3.5 characters, and the
time interval between two consecutive characters must be no more than the
transmission time of 1.5 characters.[25] For example, with the default data
rate of 19200 bit/s, the transmission times of 3.5 (t3.5) and 1.5 (t1.5) 11-bit
characters are:
For higher data rates, Modbus RTU recommends to use the fixed values
750 μs for t1.5 and 1.750 ms for t3.5.[25]

Modbus ASCII

[edit]

Modbus ASCII makes use of ASCII characters for protocol communication. The
ASCII format uses a longitudinal redundancy check checksum. Modbus ASCII
messages are framed by a leading colon (":") and trailing newline (CR/LF).

A Modbus ASCII frame includes:[27]

Length
Name Function
(bytes)

Start 1 Colon : (ASCII value 3A16)

Addres
2 Station address
s

Functi
2 Indicates the function code e.g. "read coils"
on

Data + length will be filled depending on the


Data n×2
message type

LRC 2 Checksum (longitudinal redundancy check)

Carriage return + line feed (CR/LF) pair (ASCII


End 2
values 0D16 and 0A16)

Address, Function, Data, and LRC are ASCII hexadecimal encoded values,
whereby 8-bit values (0–255) are encoded as two human-readable ASCII
characters from the ranges 0–9 and A–F. For example, a value of 122 (7A 16) is
encoded as two ASCII characters, "7" and "A", and transmitted as two
bytes, 55 (3716, ASCII value for "7") and 65 (4116, ASCII value for "A").

LRC is calculated as the sum of 8-bit values (excluding the start and end
characters), negated (two's complement) and encoded as an 8-bit value. For
example, if Address, Function, and Data are 247, 3, 19, 137, 0, and 10, the
two's complement of their sum (416) is −416; this trimmed to 8 bits is 96
(256 × 2 − 416 = 6016), giving the following 17 ASCII character
frame: :F7031389000A60␍␊. LRC is specified for use only as a checksum:
because it is calculated on the encoded data rather than the transmitted
characters, its 'longitudinal' characteristic is not available for use with parity
bits to locate single-bit errors.

You might also like