modbus_read_registers.txt 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. modbus_read_registers(3)
  2. ========================
  3. NAME
  4. ----
  5. modbus_read_registers - read many registers
  6. SYNOPSIS
  7. --------
  8. *int modbus_read_registers(modbus_t *'ctx', int 'addr', int 'nb', uint16_t *'dest')*
  9. DESCRIPTION
  10. -----------
  11. The _modbus_read_registers()_ function shall read the content of the 'nb'
  12. holding registers to the address 'addr' of the remote device. The result of
  13. reading is stored in 'dest' array as word values (16 bits).
  14. You must take care to allocate enough memory to store the results in 'dest'
  15. (at least 'nb' * sizeof(uint16_t)).
  16. The function uses the Modbus function code 0x03 (read holding registers).
  17. RETURN VALUE
  18. ------------
  19. The _modbus_read_registers()_ function shall return the number of read registers
  20. if successful. Otherwise it shall return -1 and set errno.
  21. ERRORS
  22. ------
  23. EMBMDATA::
  24. Too many registers requested
  25. SEE ALSO
  26. --------
  27. linkmb:modbus_write_register[3]
  28. linkmb:modbus_write_registers[3]
  29. AUTHORS
  30. -------
  31. The libmodbus documentation was written by Stéphane Raimbault
  32. <stephane.raimbault@gmail.com>