Modbus RTU
Modbus RTU
[edit]
1 start bit
1 bit parity
1 stop bit
Slave Function
Data CRC
address Code
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).
Length
Name Function
(bytes)
Addres
2 Station address
s
Functi
2 Indicates the function code e.g. "read coils"
on
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.