IMDTouchKnowledge BaseShop main store

Troubleshooting

Modbus 3x 4x 5x read types and decimal register entry

Industrial networks Published 8 min read

Short answer

Type the register number in the base the device manual prints — decimal for most sensors, no hex marker in the register field. Pick 4x for a 16-bit holding register, 5x when the value is 32-bit, 3x only for input registers, and fix word order before changing the register number.

On this page
  1. Why does an HMI fail to read a register its vendor tool reaches?
  2. What do the 0x, 1x, 3x, 4x and 5x prefixes select?
  3. Should I type the register number in decimal or hexadecimal?
  4. When does 4x clear the communication error but still show a wrong value?
  5. When should the tag use 5x instead of 4x?
  6. How do I verify the decoded value before it goes on the machine screen?
  7. Which read area do I pick for each case?
  8. Questions asked

Enter the register number in the base the device manual prints, with no hexadecimal marker in the register field; choose the read area from the register table — 4x for a 16-bit holding register, 5x for a 32-bit value, 3x only for true input registers — and fix word order before you touch the register number. Those three settings decided the case behind this article: a panel that could not see a temperature transmitter at all, then saw it but displayed nonsense, then settled after the tag moved to 5x.

Why does an HMI fail to read a register its vendor tool reaches? #

Because the tag, not the bus, was wrong: the register number was typed with a hexadecimal marker meant for the device address, the read area was 3x on a device that answers holding-register reads, and the tag was one 16-bit word wide.

In the reported case, the vendor's commissioning tool reached the temperature register while the HMI panel on the same bus threw a communication error, and the corrections landed in a fixed order. The register number went in as plain decimal digits, the read area moved from 3x to 4x and the communication error disappeared, and the display settled only when the tag moved to 5x as a 32-bit read. Treat a cleared error and a correct value as separate gates: reaching the register proves the master and slave agree on function code and offset; a correct display additionally needs matching width, word order and scaling. If the communication error survives all three corrections, the fault has moved to the wire or the timing, and the checks in HMI Modbus device no response over RS-485 are the right next step.

What do the 0x, 1x, 3x, 4x and 5x prefixes select? #

The leading digit selects the Modbus data table the tag reads: 0x coils, 1x discrete inputs, 3x input registers, 4x holding registers, and 5x the same holding registers read as one 32-bit value from two consecutive 16-bit registers.

The convention comes from the classic five-digit Modicon reference style, which driver documentation across the industry summarizes the same way: the leading digit names the data table and the remaining digits number the item inside it. The Modbus application protocol specification published by the Modbus Organization defines the tables and the function codes and keeps that documentation numbering off the wire: a reference such as 40001 points at item 1 of the holding-register table, and the request on the bus carries the function code plus a 16-bit offset equal to the item number minus 1, here 0, anywhere in 0 to 65535.

  • 0x — coils: read with function code 01, write with 05 (single) or 15 (multiple)
  • 1x — discrete inputs: read with function code 02, no write
  • 3x — input registers: read with function code 04, no write
  • 4x — holding registers: read with function code 03, write with 06 (single) or 16 (multiple)
  • 5x — the holding-register table addressed as one 32-bit value spanning two consecutive 16-bit registers, fetched with a single function code 03 request

Every Modbus master driver exposes these areas under some spelling, but the table-to-function-code mapping belongs to the standard, so you can read the right prefix straight out of the device manual's register table.

Should I type the register number in decimal or hexadecimal? #

Enter it in the base the device manual prints, which for most sensors is decimal: in the reported case the register is 2200 decimal, and the 16# marker typed into the register field pointed the tag at the device address instead.

The arithmetic shows how far a base mismatch lands from the target. Read the digits 2200 as hexadecimal and they mean 8704 decimal, because 2 × 4096 + 2 × 256 = 8192 + 512, which is 6504 registers above the documented cell — far enough that the slave rejects the request with an address exception or serves a different register. The 16# marker has its own job in that driver stack: it belongs to the device address, the station number that selects which slave answers on the bus. On a multidrop RS-485 network that station number is shared territory, and where an HMI gets Modbus addresses on a shared RS485 bus explains how a panel and other masters divide those addresses. So the rule is mechanical: digits only in the register field, in the base the register table prints, and the station number in the field built for it.

When does 4x clear the communication error but still show a wrong value? #

When the register is reachable but the tag is narrower than the value: a 4x tag reads one 16-bit word, so a 32-bit measurement arrives as an arbitrary half — in the reported case the display swung between 0 and 2700.

The 3x request died at the function code: the transmitter serves its measurement from holding registers, so a function 04 request came back as an exception instead of data. Moving the tag to 4x put function code 03 on the wire, the register answered, and the communication error disappeared, which proves reachability and nothing more. What remained was an interpretation fault: the register table lists this value as 32-bit, a 4x tag moves one 16-bit word, so the display saw half the number changing as the measurement updated, and those swings were the width fault showing through, not a wiring problem. Read the register table's two columns and both layers are decided at once: the table column, input versus holding, sets 3x versus 4x, and the data-type column, 16-bit signed, 32-bit integer or 32-bit float, sets the tag width and type.

When should the tag use 5x instead of 4x? #

Whenever the manual lists the value as 32-bit: set the tag to 5x so the driver reads two consecutive 16-bit registers with one function 03 request and hands you a single 32-bit number, as in the reported case where 5x settled the display.

Weintek panels expose this double-register area as read type 5x; other vendors spell the same idea as double word or 32-bit read, but every Modbus master driver has one, and the register table's 32-bit rows are the trigger to use it.

Worked example: a transmitter reports 23.4 °C as an IEEE-754 32-bit float in the register pair its table lists at 2200 and 2201, high word first, so the bytes in order are 41 BB 33 33. The first register holds 0x41BB = 4 × 4096 + 1 × 256 + 11 × 16 + 11 = 16384 + 256 + 176 + 11 = 16827, and the second holds 0x3333. A 4x tag shows 16827, which looks plausible and is wrong. The pair read in the wrong word order carries 0x333341BB, which decodes as about 0.000000042 and displays as zero. With the tag at 5x and the word order matched to the device, the same two registers carry 0x41BB3333 = 23.4 °C.

If 5x is already set and the value is still nonsense, change the word order, not the register number. A 32-bit value across two registers has four common arrangements — words as stored, words swapped, bytes swapped within each word, fully reversed — and stepping through them against the commissioning tool's value takes seconds; the same fix is walked through in how to swap words on a 32-bit Modbus tag in C-More. Once the raw bits match the vendor tool, scaling is the last layer, and scaling a 32-bit float Modbus value in an HMI script picks up from there.

How do I verify the decoded value before it goes on the machine screen? #

Compare the raw number the HMI reads with the value the device's own commissioning tool shows for the same register, on a bench or with the machine out of production, because a write to the wrong holding register can reconfigure a transmitter rather than just move a display.

  1. From the device manual's register table, write down four facts for the value: table, input or holding; number base as printed; data type; word order if the table states one.
  2. Build the tag: station number in the device address field, register digits in the address field in the table's base, read area from the table column.
  3. Compare the raw value the panel reads with the same register in the vendor's commissioning tool, on a bench device or with the line idle.
  4. If the raw values disagree, step through the four word and byte arrangements; the display snaps to the commissioning tool's number at the correct one.
  5. Apply scaling only after the raw bits match, then read the register again after a device power-up to confirm the pairing and order survived the restart.

Log the final tag settings next to the register table entry so the next engineer inherits the decision instead of the debugging session.

Which read area do I pick for each case? #

Pick from the register table, not from the error message: input-register row, 16-bit value, 3x; holding-register row, 16-bit value, 4x; holding-register row, 32-bit value, 5x with matched word order; and the register number in the base the table prints.

What the register table shows Tag setting What goes on the wire
Coil, controlled by the master 0x function 01 read, 05 or 15 write
Discrete input, read-only 1x function 02
Input register, 16-bit, read-only 3x function 04
Holding register, 16-bit 4x function 03 read, 06 or 16 write
Holding-register pair, 32-bit float or integer 5x one function 03 request, two registers
Register printed with a hexadecimal marker hex digits, base set to hexadecimal offset matches the table
Station number, not a register device address field selects the answering slave

For the transmitter in this case the decisions landed in this order: decimal digits with no hex marker in the register field, 4x instead of 3x to clear the exception, 5x to carry the 32-bit value, word order last. Keep the two gates apart when you troubleshoot your own loop: communication first, interpretation second. A tag that stops throwing errors has passed only the first gate.

Questions asked

The HMI reads the neighboring register — is the read area wrong?

No, that is a numbering mismatch between the document and the driver, not a wrong area. Some documentation numbers the first holding register as 40001, which maps to wire offset 0, and some driver displays show that same register as offset zero in the 4x area. Keep the read area, switch the driver's one-based or zero-based addressing option, and read again. The prefix selects the function code; the offset base decides which cell you land on.

What does a Modbus exception code mean when the read fails?

The slave answers an exception instead of data, and the code names the layer. Exception 01, illegal function, means the slave does not implement that function code, which is what a 3x request produces on a device that only serves holding registers. Exception 02, illegal data address, means the offset is outside the served table, the classic result of a decimal register number read as hexadecimal. Exception 03, illegal data value, means the request itself carries an invalid value. Match the code to its layer before you change any setting.

Does a 5x tag change how the register pair is numbered?

The 5x tag stays inside the holding-register table: the driver derives two consecutive register offsets from the tag address and reads both with one function code 03 request. The rule for deriving that pair differs between driver families, so take the first register of the pair from the device manual's 32-bit row and confirm the pair the driver actually requests with the vendor tool or a serial capture before touching scaling. Chasing a byte-order problem by changing the register number is the wrong lever.

The registers are right but the value is absurd — float tag or integer tag?

Decide from the data-type column in the register table, not from the size of the readings. The same 32 bits decode as a plausible engineering value when read as an IEEE-754 float and as a number over a billion when read as a signed 32-bit integer, so the wrong type makes a correct read look broken. Set the tag type from the table, match the word order, and apply scaling only after the raw value agrees with the device's own tool.

Keep reading

  • Troubleshooting

    Why a Modbus coil read fails when the request block is too long

    Exception 02 on a Read Coils exchange means the server checked every address from the start through start + quantity - 1 and found one outside its coil map, so it rejected the whole read. When a client that reads full bytes asks for 8 coils from a device that maps only 4, the first four coils in an easyE4 base unit, the valid start address still fails. Cut the quantity to fit the map; in HMI Droid that is the "Always read full bytes" setting.

    Industrial networks

  • Troubleshooting

    Decoding Modbus holding register 4500001 from PLC to HMI

    Holding register 4500001 is a typed reference, not the address on the wire: the leading 4 marks the area, the rest is a 1-based register number, and under the six-digit convention it must fall inside 400001-465536, so the reachable target is 450001, protocol address 50000. Match the slave ID and 8E1 serial settings, prove the read with an independent master, then enter the address in the HMI driver's own convention.

    Industrial networks

  • How-to

    How to Send HMI RTC Time to a PCB Over Modbus

    Modbus never broadcasts the panel clock. Configure the HMI as a Modbus client and let it write six holding registers — year, month, day, hour, minute, second — with function code 16 about once per minute, capturing all six values as one snapshot so a rollover never mixes an old date with a new time.

    Industrial networks