#18 Analog Output Holding Registers vs Analog Input Registers Reading Issue


Hi all,
I'm a beginner on ModBus I/F, please excuse me.
Using jamod I wrote a Slave on TCP that manages a pool of registers (Jamod SimpleInputRegister).
When I use an external Server (not wrote by myself) and it reads the registers with the Function Code 3 everything works fine.
If the Server reads the registers with the Function Code 4 I face a problem:
An exception rise with the value Illegal Data Address.
Probably this issue is due to my erroneous use of Analog Output Holding Registers vs Analog Input Registers.
How can I do to solve my Slave issue ?
Thanks in advance for the help.


  • Julie Haugh
    Julie Haugh

    Generally speaking, you use function code 3.

    Input registers and holding registers are two completely different registers, and they have two completely different address spaces. Many devices will implement both register types in the same address space, so that you can read using either FC3 or FC4 and read the same values.

    Typically a slave device or application will document its register map and describe the types of registers which are at each address. It is up to the master (the slave is technical the server and the other application that you didn't write is a Modbus master and the client) to request the registers using the correct command.

    One common technique when writing a general-purpose master/client is to try both FC3 and FC4, then stick with the command that actually worked.