Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document macros for error codes corresponding to Modbus exceptions #758

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,21 @@ shall return either a NULL value (if returning a pointer) or a negative value
(if returning an integer), and the actual error code shall be stored in the
`errno` variable.

This includes cases where a Modbus server returns an exception response as a
result of a failed read or write operation. The following macros expand to
integer error codes that correspond to Modbus exception responses:

- `EMBXILFUN`: illegal function (0x01)
- `EMBXILADD`: illegal data address (0x02)
- `EMBXILVAL`: illegal data value (0x03)
- `EMBXSFAIL`: server device failure (0x04)
- `EMBXACK`: acknowledge (0x05)
- `EMBXSBUSY`: server device busy (0x06)
- `EMBXNACK`: negative acknowledge (0x07)
- `EMBXMEMPAR`: memory parity error (0x08)
- `EMBXGPATH`: gateway path unavailable (0x0A)
- `EMBXGTAR`: gateway target device failed to respond (0x0B)

The *modbus_strerror()* function is provided to translate libmodbus-specific
error codes into error message strings; for details refer to
[modbus_strerror](modbus_strerror.md).
Expand Down