Julie Haugh - 2014-08-11

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.