The register map says the voltage is at register 0. You read register 0 and get an error, or a zero, or a number that has nothing to do with the display. The address is right. The table is wrong.
Choosing a Modbus holding register vs input register (or coils vs discrete inputs) is one of the most common reasons a first read fails. This guide explains the four Modbus tables, the function code for each, how to read the table from a register map, and what to try when the map is unclear, with real screenshots of ModLens reading the free ModLens Sim.
Modbus holding register vs input register: what is the difference?
An input register is read-only; a holding register can be read and written. Both hold one 16-bit word. Input registers are read with function code 04. Holding registers are read with function code 03 and written with function code 06 (one register) or 16 (several registers).
The MODBUS Application Protocol Specification V1.1b3 (modbus.org) defines four primary tables:
| Table | Object type | Access | What the spec says it is for | Usual prefix |
|---|---|---|---|---|
| Discrete inputs | Single bit | Read-only | Data provided by an I/O system | 1x (10001…) |
| Coils | Single bit | Read-write | Data that an application program can change | 0x (00001…) |
| Input registers | 16-bit word | Read-only | Data provided by an I/O system | 3x (30001…) |
| Holding registers | 16-bit word | Read-write | Data that an application program can change | 4x (40001…) |
In practice:
- Input registers (3x) usually carry measurements: temperatures, voltages, currents, power, energy counters, status words.
- Holding registers (4x) usually carry settings and commands: setpoints, speed references, modes, configuration, and often measurements too.
- Coils (0x) are on/off commands you can write: start/stop, enable, reset.
- Discrete inputs (1x) are on/off states you can only read: running, alarm, door open, filter dirty.
The word "usually" matters: the device maker decides what goes where. Many controllers, drives and meters put everything, measurements included, in holding registers. The register map, not the type of value, is the final answer.
Function codes for each table
Each table has its own read function code, and only coils and holding registers have write codes. The table you pick in your tool simply chooses the function code that goes into the frame.
| Function code | Name in the spec | Table | Max quantity per request |
|---|---|---|---|
| 01 | Read Coils | Coils | 1 to 2000 bits |
| 02 | Read Discrete Inputs | Discrete inputs | 1 to 2000 bits |
| 03 | Read Holding Registers | Holding registers | 1 to 125 registers |
| 04 | Read Input Register | Input registers | 1 to 125 registers |
| 05 | Write Single Coil | Coils | 1 (0xFF00 = ON, 0x0000 = OFF) |
| 06 | Write Single Register | Holding registers | 1 register |
| 15 | Write Multiple Coils | Coils | 1 to 1968 bits |
| 16 | Write Multiple Registers | Holding registers | 1 to 123 registers |
The limits come from the specification (253-byte PDU). Some devices accept fewer, so if a big block fails, try a smaller count before blaming the table.
Two consequences:
- Nothing can write an input register or a discrete input. A writable value (setpoint, speed reference) is a holding register or a coil.
- The prefix is never sent. The "3" in 30001 or "4" in 40001 only picks the function code; the frame carries a zero-based address from 0 to 65535.
Is input register 0 the same as holding register 0?
Not necessarily. The four tables are separate address spaces, so input register 0 and holding register 0 can hold completely different data, or one of them may not exist at all.
The specification allows both designs: a device can keep four separate blocks of memory, or map the tables over the same data so that, for example, the same value appears in both the input and the holding table. On site you will meet:
- Separate tables (most common): the meter's voltage is at input address 0; holding address 0 is a configuration value, or doesn't exist.
- Mirrored tables: the device answers the same data on FC03 and FC04. Reading the wrong table "works" by luck.
- Holding only: the device does not support FC04 at all and answers with exception 01 (Illegal Function).
So when a value looks wrong, "same address, other table" is one of the first tests to do.
How do I know which table my device uses?
Look at the register map first: the prefix, a column called "type", "function" or "access", or the function code itself tells you. Here is how to read the common styles of register maps:
| What the map shows | Table | Read with |
|---|---|---|
| 30001, 30002… or 300001… | Input registers | FC04 |
| 40001, 40002… or 400001… | Holding registers | FC03 |
| "IR", "Input Reg", "3x" | Input registers | FC04 |
| "HR", "Holding", "4x" | Holding registers | FC03 |
| "R" or "RO" next to a register | Often input, sometimes holding read-only | Try FC04, then FC03 |
| "R/W" or "RW" | Holding registers | FC03 / FC06 / FC16 |
| "FC 03" or "0x03" in a column | Holding registers | FC03 |
| "FC 04" or "0x04" in a column | Input registers | FC04 |
| "Coil", "DO", "0x" | Coils | FC01 / FC05 / FC15 |
| "Status", "DI", "1x" | Discrete inputs | FC02 |
| Only addresses, no prefix, no type | Unknown: often holding | Test both (see below) |
Watch out for a trap: "R" (read-only) does not always mean input register. Many vendors list read-only holding registers, which you read with FC03 but cannot write. When the map says "Read" and gives a 4x number, the table is holding.
If you also need to convert the number in the map into the address you type in your tool, the free Modbus register converter does it for 0x, 1x, 3x and 4x references.
Worked example: the same address in two tables
Here is a real case from the simulator, which mimics two very common devices:
- Unit 2, a main power meter: measurements in input registers, 32-bit floats with CDAB word order. Voltage at input address 0, current at 2, active power at 4, power factor at 6 (uint16 × 0.001), energy at 10 (uint32 kWh).
- Unit 1, an AHU controller: everything in holding registers. Supply air temperature at holding address 0 (int16 × 0.1), return air temperature at 1 (float32 ABCD), duct static pressure at 3 (float32 CDAB), fan speed command at 10, supply temperature setpoint at 11 (int16 × 0.1). Plus one coil (occupancy schedule) and one discrete input (filter alarm), both at address 0.
Same address 0, five different meanings. The screenshots show each read.
Step by step: test holding vs input registers in ModLens
Read the same address in both tables and compare: the right table gives values that match the device display. You can follow these steps with the free ModLens trial and the free ModLens Sim, or on your own device.
Step 1: Read the input registers (FC04)
Connect to the device in Devices, open Explorer, set the Unit ID, choose Input registers (3x) in the Table list, start address 0, count 12, and click Read.

The meter answers. In the FLOAT32 CDAB column (highlighted in green because the values look like real measurements) you see 230 at address 0 (voltage), 10 at address 2 (current) and 6.9 at address 4 (active power in kW). Address 6 shows a raw 900, which is the power factor 0.900 with a × 0.001 scale. Addresses 7 to 9 "don't exist on this device", and address 10 starts the energy counter: as UINT32 ABCD it reads 512000 kWh. This is the right table.
Raw values alone (0 and 17254) mean nothing; only the 32-bit float with the right word order gives 230. If a float looks absurd, the table may be right and the byte order wrong: see Modbus float byte order explained.
Step 2: Read the same address as holding registers (FC03)
Keep everything the same and change only the Table to Holding registers (4x). Click Read again.

All 12 addresses now show "doesn't exist on this device". The meter has no holding registers there, so it rejects the request (this is what exception code 2, Illegal Data Address, looks like in practice). A beginner who only tries FC03 would conclude that the address in the map is wrong. It isn't: the table is.
On a real device, the wrong table can also return zeros, settings, or the same data (mirrored tables), so always compare with the display.
Step 3: Read a controller that uses holding registers
Now change the Unit ID to 1 (the AHU controller), keep Holding registers (4x), address 0, count 12, and click Read.

This controller keeps its measurements in holding registers:
- Address 0: raw 144, the supply air temperature 14.4 °C (int16, × 0.1).
- Addresses 1–2: 21.77278 in the FLOAT32 ABCD column, the return air temperature in °C.
- Addresses 3–4: 1.429118 in the FLOAT32 CDAB column, the duct static pressure in inWC.
- Address 10: 65, the fan speed command in %.
- Address 11: 140, the supply temperature setpoint 14.0 °C (int16, × 0.1).
Measurements and setpoints share one table, which is common on HVAC controllers and drives.
Step 4: Read the coils (FC01)
Change the Table to Coils (0x), address 0, count 8, and click Read.

Coil 0, the occupancy schedule, is ON (it was a weekday afternoon when the screenshot was taken). The Write column offers Turn OFF: coils are writable, and ModLens sends function code 05 for that. Coils 1 to 7 don't exist. Results for bit tables show ON/OFF states, not number formats.
Step 5: Read the discrete inputs (FC02)
Change the Table to Discrete inputs (1x) and click Read.

Discrete input 0, the filter alarm, was ON at that moment. There is no write column, because Modbus has no function code to write a discrete input. Same address 0 as the coil, but a different table and a different meaning.
Step 6: No map? Let ModLens search both tables
When you don't know the table at all, open Find a value, type the value shown on the device display, keep Registers on Holding + input, and click Search.

For a voltage of 230.3, ModLens checks unit IDs 1–5 in both tables and returns two candidates. The best match is unit 2, table input, address 0, float32, CDAB, which decodes to exactly 230.3 (raw 19661 17254). The second (input address 1, ABCD) is a coincidence of overlapping words; enter a new value later and click Re-check candidates to remove it. The full method is in How to find a Modbus register address.
Note that Find a value searches registers only. On/off values (coils and discrete inputs) must be read in the Explorer, as in steps 4 and 5.
Which one should I read in my software?
Pick the table in your master, PLC, BMS or library, not by changing the address. Every Modbus client has a setting for it, but the wording varies:
| Where you configure it | Holding registers | Input registers | Coils | Discrete inputs |
|---|---|---|---|---|
| Generic test tools | "Holding registers", "03", "4x" | "Input registers", "04", "3x" | "Coils", "01", "0x" | "Discrete inputs", "02", "1x" |
| Node-RED Modbus read node | FC 3 | FC 4 | FC 1 | FC 2 |
| Home Assistant Modbus integration | input_type: holding |
input_type: input |
input_type: coil |
input_type: discrete_input |
| pymodbus (Python) | read_holding_registers() |
read_input_registers() |
read_coils() |
read_discrete_inputs() |
| BMS / PLC drivers | Often "4x" or "Holding" in the point address | "3x" or "Input" | "0x" or "Coil" | "1x" or "Status" |
Some drivers want the full reference (40001) and derive the function code from the first digit; others want the table and a zero-based address. Check the driver's help once.
Common mistakes and how to fix them
Most "wrong table" problems show up as exception 01, exception 02, zeros, or values that don't match the display.
- Reading FC03 because "everything is holding registers". Many meters and sensors put measurements in input registers only. If FC03 returns exception 02 or zeros, try FC04 at the same address.
- Reading FC04 on a device that doesn't support it. The reply is exception 01, Illegal Function. Switch to holding registers.
- Trying to write an input register. There is no write function for input registers. If a value must be written, look for it in the holding table; the manual may list the setpoint at a different address.
- Putting the prefix in the address. Typing 30001 as the address with FC04 asks for input address 30001, not 0. Strip the prefix: 30001 → FC04 address 0, 40011 → FC03 address 10. (The full conversion is in our register map guide.)
- Assuming mirrored tables. One model answers the same data on FC03 and FC04; the next may not.
- Mixing up coils and discrete inputs. Both are bits and both may answer at address 0, but only coils can be written.
- Reading too many registers at once. A block that spans a gap is often rejected as a whole, which looks like a wrong table. Start with 2 to 10 registers.
- Writing a holding register you don't understand. Holding registers include configuration (baud rate, unit ID, CT ratio). A wrong write can stop communication. Write only what the map clearly describes.
On/off values packed inside registers
Not every on/off value lives in a coil or a discrete input. Many devices pack 16 alarms or states into one holding or input register, called a "status word" or "alarm word", where each bit has a meaning (bit 0 = running, bit 3 = fault, and so on).
A raw value of 9 (binary 1001) means bits 0 and 3 are set. Read the word with FC03 or FC04, then test the bits; the ModLens inspector shows each bit when you click a register in the Explorer.
If your map lists "bit 0 … bit 15" under one address, it's a packed word, not a coil table.
FAQ
What is the difference between Modbus input registers and holding registers?
Input registers are read-only 16-bit values, read with function code 04. Holding registers are 16-bit values that can be read with function code 03 and written with 06 or 16. Input registers usually carry measurements, holding registers usually carry setpoints and settings, but many devices also put measurements in holding registers. The register map tells you which table each value is in.
Can I write to a Modbus input register?
No. The Modbus specification has no function code to write an input register, so input registers are always read-only. If you need to change a value, it must be in the holding register table (or be a coil for on/off commands). If the manual lists a writable value as "input", it usually means a holding register.
Why does my device return exception 02 when I read holding registers?
Exception 02 (Illegal Data Address) means the device has no register at that address in that table. The most common causes are reading the wrong table (the value is an input register), an off-by-one address (the map counts from 1), or a block that runs past the last register. Try FC04 at the same address, then the address minus 1, then a smaller count.
Is 30001 an input register and 40001 a holding register?
Yes. In the classic Modicon numbering, 3xxxx means input register and 4xxxx means holding register, and the numbers count from 1. So 30001 is input register address 0 (FC04) and 40001 is holding register address 0 (FC03). The prefix is never sent in the Modbus frame; it only tells you the function code.
What is the difference between coils and discrete inputs?
Both are single on/off bits. Coils (0x) can be read with function code 01 and written with 05 or 15, so they are used for commands like start/stop or reset. Discrete inputs (1x) can only be read, with function code 02, and represent states like running, alarm or a contact closed.
Are input register 0 and holding register 0 the same value?
Not necessarily. The four Modbus tables are separate address spaces, and the specification lets each device decide whether they hold different data or the same data. On many meters, input address 0 is a measurement and holding address 0 doesn't exist or is a setting. Always check the register map or compare both reads with the device display.
What happens if a device doesn't support function code 04?
It replies with exception 01 (Illegal Function). This is normal on devices that keep all their data in holding registers. Switch your master to function code 03; the addresses in the map stay the same.
How many holding registers can I read at once?
The specification allows 1 to 125 registers per read with function codes 03 and 04, and 1 to 123 per write with function code 16. Many devices accept fewer, and a block that includes a missing address is often rejected as a whole. Start with small blocks and increase once the reads work.