modbus_report_slave_id.txt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. modbus_report_slave_id(3)
  2. =========================
  3. NAME
  4. ----
  5. modbus_report_slave_id - returns a description of the controller
  6. SYNOPSIS
  7. --------
  8. *int modbus_report_slave_id(modbus_t *'ctx', uint8_t *'dest');*
  9. DESCRIPTION
  10. -----------
  11. The _modbus_report_slave_id()_ function shall send a request to the controller
  12. to obtain a description of the controller.
  13. The response stored in 'dest' contains:
  14. * the byte count of the response
  15. * the slave ID, this unique ID is in reality not unique at all so it's not
  16. possible to depend on it to know how the information are packed in the
  17. response.
  18. * the run indicator status (0x00 = OFF, 0xFF = ON)
  19. * additional data specific to each controller. For example, libmodbus returns
  20. the version of the library as a string.
  21. RETURN VALUE
  22. ------------
  23. The _modbus_report_slave_id()_ function shall return the number of read data if
  24. successful. Otherwise it shall return -1 and set errno.
  25. EXAMPLE
  26. -------
  27. [source,c]
  28. -------------------
  29. uint8_t *tab_bytes;
  30. ...
  31. rc = modbus_report_slave_id(ctx, tab_bytes);
  32. if (rc > 1) {
  33. printf("Run Status Indicator: %s\n", tab_bytes[1] ? "ON" : "OFF");
  34. }
  35. -------------------
  36. AUTHORS
  37. -------
  38. The libmodbus documentation was written by Stéphane Raimbault
  39. <stephane.raimbault@gmail.com>