Modbus exception codes
- Last UpdatedAug 29, 2024
- 2 minute read
Additionally, there are exception codes generated by Modbus. The accompanying table shows these exceptions and their explanations.
|
Exception Code (Hex) |
Name |
Explanation |
|---|---|---|
|
01 |
ILLEGAL FUNCTION |
The function code received in the query is not an allowable action for the slave. This may be because the function code is only applicable to newer controllers, and was not implemented in the unit selected. It could also indicate that the slave is in the wrong state to process a request of this type; for example, because it is unconfigured and is being asked to return register values. |
|
02 |
ILLEGAL DATA ADDRESS |
The data address received in the query is not an allowable address for the slave. More specifically, the combination of reference number and transfer length is invalid. For a controller with 100 registers, a request with offset 96 and length 4 would succeed, a request with offset 96 and length 5 will generate exception 02. |
|
03 |
ILLEGAL DATA VALUE |
A value contained in the query data field is not an allowable value for the slave. This indicates a fault in the structure of the remainder of a complex request, such as that the implied length is incorrect. It specifically does NOT mean that a data item submitted for storage in a register has a value outside the expectation of the application program, since the MODBUS protocol is unaware of the significance of any particular value of any particular register. |
|
04 |
ILLEGAL RESPONSE LENGTH |
Indicates that the request as framed would generate a response whose size exceeds the available MODBUS data size. Used only by functions generating a multi-part response, such as functions 20 and 21. |
|
05 |
ACKNOWLEDGE |
Specialized use in conjunction with programming commands. |
|
06 |
SLAVE DEVICE BUSY |
Specialized use in conjunction with programming commands. |
|
07 |
NEGATIVE ACKNOWLEDGE |
Specialized use in conjunction with programming commands. |
|
08 |
MEMORY PARITY ERROR |
Specialized use in conjunction with function codes 20 and 21 to indicate that the extended file area failed to pass a consistency check. |
|
0A |
GATEWAY PATH UNAVAILABLE |
Specialized use in conjunction with gateways; it indicates that the gateway was unable to allocate a Modbus Plus PATH to use to process the request. It usually means that the gateway is misconfigured. |
|
0B |
GATEWAY TARGET DEVICE FAILED TO RESPOND |
Specialized use in conjunction with gateways; it indicates that no response was obtained from the target device. It usually means that the device is not present on the network. |