Modbus Tools Guide

1. Start with a captured request and response

  1. Copy one complete frame from a trusted capture or device log into Frame Diagnostics; select RTU or TCP when known.
  2. Supply the response to check unit ID, function, transaction ID (TCP), quantity and write echoes.
  3. For register data, use Open Register Decoder and configure offsets, types, order and scale using the device manual.

These tools do not connect to TCP devices. A valid frame does not prove a physical device accepted a command.

2. Frame structure and function codes

RTU = device address + PDU + CRC (low byte first);TCP = MBAP + PDU。

MBAP has transaction ID (2 bytes), protocol ID (2, zero), length (2) and Unit ID (1). Length counts Unit ID plus PDU; TCP does not append RTU CRC.

HEXOperationQuantity limit
01Read coils2000 bits
02Read discrete inputs2000 bits
03Read holding registers125 registers
04Read input registers125 registers
05Write single coil1 bit
06Write single register1 register
0FWrite multiple coils1968 bits
10Write multiple registers123 registers
01 03 00 00 00 02 C4 0B
01 03 04 00 01 00 02 2A 32

This RTU pair reads two holding registers at offset 0; the returned raw UInt16 values are 1 and 2. An exception response sets the function high bit, for example 0x83 with exception 02 (Illegal Data Address). RTU broadcast address 0 is for writes and has no response.

3. Address notation is not the wire address

Holding register 40001 (five digits) and 400001 (six digits) both map to protocol offset 0 under their respective reference conventions. Register 40002 maps to offset 1. Some manuals already use zero-based offsets: confirm the manual before subtracting one.

One register is 16 bits. A Float32 consumes two registers, Float64 and Int64/UInt64 consume four. Decoder offsets count registers, not bytes. Read responses do not contain their starting address.

Open address converter

4. Byte order and word order

Modbus transmits the high byte of each 16-bit register first. Interpretation across multiple registers depends on the device mapping. For Float32 value 1.0, compare:

OrderWire bytes
ABCD3F 80 00 00
BADC80 3F 00 00
CDAB00 00 3F 80
DCBA00 00 80 3F

For 64-bit values, this tool uses BADC for byte-swap within each word, CDAB for reversing all four 16-bit words, and DCBA for both. For a single 16-bit value, CDAB leaves the word unchanged. Confirm the actual layout rather than relying on vendor names such as little-endian.

5. Integers, floating point and scaling

UInt64 FFFF FFFF FFFF FFFF decodes to 18446744073709551615; the same bits as Int64 decode to -1. BigInt and decimal arithmetic preserve integer precision, including raw × k + b with decimal coefficients.

Example: raw UInt16 234 with k=0.1 and b=0 gives 23.4. Blank decimal places displays the full decimal result; a specified count rounds halves away from zero. Float32/64 follow IEEE 754 and may already contain binary approximation errors. NaN/±Infinity are shown without scaling, and raw negative zero is retained.

6. Configuration and CSV

Save stores input format and rules in this browser only, not captured register data. Export JSON to transfer rules to another browser; import replaces the current rules after validation. No account or server synchronization is involved.

CSV uses UTF-8 with a BOM, quotes cells, and protects formula-like content. Spreadsheet software may reinterpret long integers or dates: import raw/scaled columns as text to retain precision. CSV exports freshly decoded results; fix invalid rules before export.

7. Common issues

  • CRC fails: verify the captured frame is complete and includes exactly one RTU frame; check low-byte-first CRC order.
  • MBAP length fails: verify you have a complete TCP ADU, not a partial TCP segment or multiple concatenated frames.
  • Unexpected value: check register offset, type, signedness, byte/word order and scale in that order.
  • Rule out of range: Float64/Int64/UInt64 need four consecutive registers; supply enough data.
  • An exception is a valid device reply but not a successful operation. Auto-detection can be ambiguous; manually choose transport and direction when necessary.