You are offline. The tools work from the copy saved in this browser; pages you have not opened yet need a connection.
Modbus Request Generator
Pick a function, enter the register as written in the device manual and get the request ready to send in RTU, TCP and ASCII. Paste the reply and the tool checks it.
Request
ExampleEnter the register exactly as the manual lists it: 40001, 400001, 4x0001, 0 or 0x006B. The tool works out the address that goes into the frame.
Ready to send
- Modbus RTU (with CRC)
- Modbus TCP (with MBAP header)
- Modbus ASCII
- Expected reply
Byte by byte (RTU)
| Bytes | Field | Meaning |
|---|
Check the reply
ExamplePaste what came back, from a serial log, Wireshark or Modbus Poll. RTU, TCP and ASCII all work; the request in front of it can stay.
Runs entirely in your browser. Nothing you enter is sent to a server.
What requests and replies carry
| Function | Request | Normal reply |
|---|---|---|
| 01, 02 | first address (2), quantity (2) | byte count (1), states: 8 per byte, the first one in bit 0 |
| 03, 04 | first address (2), quantity (2) | byte count (1), registers: 2 bytes each, high byte first |
| 05 | address (2), FF 00 = ON or 00 00 = OFF | the same bytes as the request |
| 06 | address (2), value (2) | the same bytes as the request |
| 15 | first address (2), quantity (2), byte count (1), states | first address (2), quantity (2) |
| 16 | first address (2), quantity (2), byte count (1), values (2 each) | first address (2), quantity (2) |
| exception | – | function code + 0x80 (1), exception code (1) |
Numbers in brackets are bytes. Everything is sent high byte first except the RTU CRC. In RTU the device address comes first and the CRC last; in TCP the MBAP header comes first.
How a Modbus request is built
Every request has the same core: the device address, the function code and the data, usually the first address and how many registers or coils to read, or the values to write. The transport only wraps it differently. Modbus RTU appends a CRC, sent low byte first. Modbus TCP puts a 7-byte MBAP header in front (transaction ID, protocol ID 0, length, unit ID) and has no CRC. Modbus ASCII sends the same bytes as hex text between a colon and CR LF, closed by an LRC.
Device manuals mostly list register numbers such as 40001, while the frame carries an address that starts at 0. The generator takes the number as printed and does the conversion; the address converter explains it in detail.
Common mistakes
- Address off by one. Register 40001 is address 0 in the frame. If the device returns values from the neighbouring register or exception 02, try one lower or one higher.
- Wrong function for the table. 4x registers are read with function 03, 3x registers with 04. Reading a 3x register with 03 returns exception 01 or 02, or a completely different value. The tool warns when the number and the function do not fit.
- Too many registers at once. The protocol allows 125 registers per read, but many devices allow fewer or refuse to read across a gap in their register map. Split the read into blocks.
- 32-bit values written in halves. A Float32 or Int32 occupies two registers. Write both in one request with function 16; with 06 the device may reject the first half or briefly hold a wrong value. Get the two registers from the value encoder.
- Unit ID over TCP. A Modbus TCP to RTU gateway uses the unit ID to pick the serial device. A device connected directly often ignores it or expects 1 or 255.
Checking the reply
Paste what the device sent back and the tool checks the CRC or LRC, the device address, the function code, the transaction ID, the number of data bytes and, for writes, that the device confirmed the right address and value. An exception reply is translated with its most likely cause. Register values from a good reply go to the register decoder in one click, and the whole exchange opens in the frame decoder.
Questions from practice
What does a Modbus RTU request to read holding registers look like?
For example 01 03 00 00 00 0A C5 CD: device 1, function 03, first address 0 (register 40001), 10 registers and the CRC C5 CD. Over Modbus TCP the same request is 00 01 00 00 00 06 01 03 00 00 00 0A, without a CRC.
How many registers can one request read or write?
Up to 125 holding or input registers (functions 03 and 04), 2000 coils or discrete inputs (01 and 02), and writes of up to 123 registers (16) or 1968 coils (15). The limits follow from the 253-byte maximum of the protocol data unit. Many devices allow less, so if a large read fails, split it.
Should I write with function 06 or 16?
Function 06 writes exactly one register, function 16 writes one or more. Use 16 for 32-bit values such as Float32 or Int32 so both halves arrive at once. Some devices support only one of the two; exception 01 in the reply means the function is not supported.
Why does the device not answer my request at all?
No reply means the device never understood the frame: wrong baud rate or parity, a different device address, swapped A and B wires, a missing termination, or a broken CRC. Over TCP, check port 502 and the unit ID. An exception reply is different: the device understood the request and refused it.
What is the transaction ID in Modbus TCP?
Any number the client picks. The device copies it into the reply, so the client knows which request the reply belongs to when several are in flight. The protocol ID next to it is always 0, and the length field counts the bytes after it: the unit ID plus the PDU.
Related tools
- Register DecoderFloat32, Int32, UInt16 and bits in every byte order, plus Find my value.
- Address Converter40001 ↔ offset 0, 4x/3x/0x/1x notation, 5- and 6-digit addresses.
- Value EncoderTurn a value like 230.5 into registers for every byte order.
- CRC-16 CalculatorModbus RTU checksum in wire order, plus a full frame check.
- Frame DecoderRead RTU and TCP frames from Wireshark or a serial log.
- Frame ConverterThe same Modbus frame as RTU, TCP and ASCII, with CRC, header and LRC recalculated.
- Function & Exception CodesWhat each code means and the usual cause in practice.
- Status Word DecoderName each bit of a 16- or 32-bit status register.
- Modbus RTU Timing CalculatorCharacter time, t1.5 and t3.5, frame length, shortest timeout and how many reads per second fit on the line.
- 4–20 mA ScalingRaw values to engineering units, 0–10 V and 4–20 mA with fault detection.
- IEEE 754 ConverterFloat32 and Float64 to hex and back, bit by bit, with registers for every byte order.
- CRC-8 / CRC-16 / CRC-32 CalculatorAny CRC from 3 to 82 bits: 113 named algorithms, your own parameters, and finding which CRC a device uses.
- S5TIME / DT / DTL ConverterSiemens S7 time formats: S5TIME, TIME, DATE, TOD, DATE_AND_TIME and DTL to raw hex and Modbus registers and back.
- P1 Telegram Decoder (DSMR)Decode a smart meter P1 telegram (DSMR, Belgian e-MUCS): OBIS codes, CRC check, power per phase, gas and water.
- Pt100 / Pt1000 CalculatorResistance to temperature and back per IEC 60751, with 2-wire lead error and tolerance classes.
- Thermocouple CalculatormV to °C and back for types K, J, T, E, N, R, S and B, with cold junction compensation.
- Register mapsReady-made register maps for meters, inverters and batteries.