1 # modbus_read_input_registers
5 modbus_read_input_registers - read many input registers
10 int modbus_read_input_registers(modbus_t *ctx, int addr, int nb, uint16_t *dest);
15 The *modbus_read_input_registers()* function shall read the content of the `nb`
16 input registers to address `addr` of the remote device. The result of the
17 reading is stored in `dest` array as word values (16 bits).
19 You must take care to allocate enough memory to store the results in `dest` (at
20 least `nb * sizeof(uint16_t)`).
22 The function uses the Modbus function code 0x04 (read input registers). The
23 holding registers and input registers have different historical meaning, but
24 nowadays it's more common to use holding registers only.
28 The function shall return the number of read input registers if
29 successful. Otherwise it shall return -1 and set errno.
33 - *EMBMDATA*, too many bits requested.
37 - [modbus_read_input_bits](modbus_read_input_bits.md)
38 - [modbus_write_register](modbus_write_register.md)
39 - [modbus_write_registers](modbus_write_registers.md)