Skip to content
Start free evaluation

Serial line: RTU and ASCII

Serial-line Modbus adds an address and an error check to the PDU and sends it between devices connected by RS-232 or RS-485. There are two transmission modes, RTU and ASCII, and every device on one bus must use the same mode and the same line settings. This page is based on sections 2 (data link layer) and 3 (physical layer) of the MODBUS over Serial Line Specification and Implementation Guide V1.02.

The serial specification calls the client the master and the server the slave. A bus has exactly one client and up to 247 servers (§2.1).

Address Use (§2.3)
0 Broadcast. Every server processes the request and none responds.
1–247 Individual server addresses
248–255 Reserved

A client sends requests in one of two ways (§2.2):

  • Unicast: to one server at address 1–247. The client waits for the response timeout and treats a missing response as an error.
  • Broadcast: to address 0, for write requests only. Because nobody answers, the client waits a turnaround delay that gives the servers time to process the request, then sends the next one.

A serial line sends bytes as characters, each framed by a start bit, data bits, a parity bit and stop bits.

Mode Data bits Default format Allowed formats Bits per character
RTU (§2.5.1) 8 8E1 (even parity, 1 stop bit) 8O1, 8N2 11
ASCII (§2.5.2) 7 7E1 7O1, 7N2 10
  • Even parity is the default.
  • Without parity, two stop bits keep the character length the same. PDComm rejects no parity with one stop bit (8N1, 7N1) as Invalid endpoint configuration. If a device is set to 8N1, change it to 8E1 (recommended) or 8N2.
  • Section 3.2 requires 9600 and 19200 bit/s and makes 19200 bit/s the default.

PDComm selects 8 data bits when transport is rtu and 7 when it’s ascii. You set parity and stop_bits in the configuration.

RTU sends bytes as they are. A frame is a one-byte address, the PDU and a two-byte CRC.

+-----------+---------------------+---------+---------+
| address 1B| PDU | CRC low | CRC high|
+-----------+---------------------+---------+---------+
01 03 00 00 00 0A C5 CD

RTU has no start or end characters; silence separates frames (§2.5.1.1).

  • t3.5: frames are separated by at least 3.5 character times of silence.
  • t1.5: if the gap between two characters inside a frame exceeds 1.5 character times, the frame is incomplete and discarded.
  • Above 19200 bit/s, t1.5 is fixed at 750 µs and t3.5 at 1.750 ms.
Rate and format Character time t1.5 t3.5
9600 bit/s, 8E1 1.146 ms 1.719 ms 4.011 ms
19200 bit/s, 8E1 0.573 ms 0.860 ms 2.006 ms
38400 bit/s and above 0.750 ms 1.750 ms

On an RS-485 multidrop bus every server receives every frame. Each server delimits frames by t3.5 silence and answers only requests for its own address. A broadcast write to address 0 is applied by every server, and none of them replies.

USB serial adapters and operating system drivers hand received bytes to applications in batches; an FTDI adapter’s default latency timer is 16 ms. Gaps you observe on a PC are therefore not the t1.5 and t3.5 of the line. PDComm handles this as follows:

  • A client completes a response by the length its function code defines and by its CRC, so a late batch doesn’t make it drop the response.
  • Before sending a request, the client discards leftover input, and it keeps at least t3.5 between frames.
  • Serial entries in trace have timestamp_scope host_io_batch: the time the PC finished a read, not UART bit times.

RTU uses CRC-16 (§2.5.1.2), computed over the address and the PDU with the initial value 0xFFFF and the polynomial 0xA001 (0x8005 bit-reversed), and appended low byte first. The CRC of 01 03 00 00 00 0A is 0xCDC5, sent as C5 CD. A receiver drops a frame with a wrong CRC and doesn’t answer, so the client sees a timeout.

ASCII sends every byte as two hexadecimal characters (§2.5.2). A frame starts with : (0x3A) and ends with CR LF. Hex digits are the uppercase characters 0–9 and A–F.

: 01 03 00 00 00 0A F2 CR LF
| | | | +-- end (function 08/03 can change the final character)
| | +- PDU +------ LRC
| +----- address
+-------- start
  • LRC (§2.5.2.2): the two’s complement of the 8-bit sum of the address and PDU bytes. 01+03+00+00+00+0A = 0x0E, so the LRC is 0xF2.
  • Gaps between characters: ASCII allows up to one second between characters. PDComm’s ascii_timeout_ms (default 1000) is that limit; beyond it, the partial frame is discarded.
  • The same PDU takes more than twice as many characters as in RTU. ASCII trades efficiency for readability and relaxed timing.

Section 3 is mostly about RS-485:

Interface Description
RS-485 two-wire Several devices share one pair (D0, D1) plus a common line. It’s half duplex, so the transmitting device switches its driver direction.
RS-485/RS-422 four-wire Separate transmit and receive pairs. Optional.
RS-232 Short point-to-point links. Optional.
  • Terminate both ends of an RS-485 bus, and bias (polarize) the idle line at one point. Follow the device and adapter instructions for values and placement.
  • An RS-232 adapter can’t talk to an RS-485 port directly; you need a converter.
  • Check the installed wiring with the real devices connected.

Configure serial ports walks through connecting a PC to a device.