modbus_read_bits.txt 1015 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 _modbus_read_bits()_ function shall return the number of read bits if
  20. successful. Otherwise it 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>