Open control cabinet in a plant room with terminal blocks and I/O modules, laptop showing register data
TECHNICAL NOTE

Modbus Addressing: 40001, Function Codes and Address Conversion

The manual says 40001, yet the frame on the wire carries 0x0000. Once you understand that conversion, most “can’t read the value” problems go away.

Published
BASICS

What 40001 means

It is a Modicon convention: the first digit names the data table, and the last four digits give the item number.

4 = Holding Register

The first digit only tells you which table the data lives in.

0001 = item 1

Item numbers start at 1; addresses in the frame start at 0, so subtract 1.

Four data tables, each with its own numbers and function codes

Coil

Range
00001–09999
Read
01
Write
0515

Size: 1 bit
Typical: Digital outputs, relays

Discrete Input

Range
10001–19999
Read
02
Write
Not writable

Size: 1 bit
Typical: Digital inputs, contact status

Input Register

Range
30001–39999
Read
04
Write
Not writable

Size: 16 bit
Typical: Measured values

Holding Register

Range
40001–49999
Read
03
Write
0616

Size: 16 bit
Typical: Setpoints, analog outputs, measured values

CONVERT

Enter a number and follow the data

Examples
MasterConverts the number
Table
Holding Register
Function code
03
Address
0x000C(DEC 12)

40013 − 40001 = 12

Value read
0x26F4
(DEC 9972)
Sample value
RequestMaster → Slave
01Slave
03Function
00 0CAddress
00 01Quantity
44 09CRC
ResponseSlave → Master
01Slave
03Function
02Byte count
26 F4Value
A3 A3CRC
Slave 1Holding Register
NumberAddressValue
400110x000A0x213E
400120x000B0x2419
400130x000C0x26F4
400140x000D0x02BF
400150x000E0x059A

Click a row to select it.

Value read
0x26F4
(DEC 9972)
Sample value
IN PRACTICE

Applying it to RIO remote I/O

Each slot has 4 addresses. DI sits in the discrete-input table, DO in the coil table and AI/AO in the holding registers; all three share the same address range.

Build your I/O in the RIO configurator →
LLD-Modbus32E-01 bare board front, module slots 01–05 and EXT, remote I/O controller
Module 040x000C–0x000F4 addresses
Slot
Module
Channel
ModIO-AICH 01
Action
Function code
03
Address(DEC 12)
0x000C
NumberHolding Register
40013
Request frame (slave 1)
01Slave
03Function
00 0CAddress
00 01Quantity
44 09CRC

How to use: Pick a model, choose a slot on the photo or with the buttons, then set the module, channel and read or write. The function code, address, number and request frame update as you go.

TROUBLESHOOTING

Can’t read a value? First check whether the device replies

It replies with an exception

The wiring works; the request is the problem. An exception reply adds 0x80 to the function code — a failed 03 comes back as 0x83.

These four exception codes are defined by the Modbus specification and are the same for every vendor. The spec also defines 05, 06, 08, 0A and 0B for special cases and gateways.
CodeMeaningCheck first
01Illegal functionWrong function code, or the device does not support it
02Illegal data addressOff by one, wrong base subtracted, or the range runs past the address map
03Illegal data valueMalformed or too long, e.g. more than 125 registers in one 03 request
04Server device failurePower-cycle and retry; contact the manufacturer if it persists

No reply at all

A device that never received the request, or received it with a parity or CRC error, stays silent. This is usually a wiring or settings problem.

  • Slave ID matches
  • Baud rate, parity and stop bits match
  • RS-485 D+ / D− are not swapped