modbus_read_bits.txt 996 B

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