3. EXCEPTION CODES
When the slave (instrument) receives a not-valid query or command, an error response is sent. The error
response structure is following described according to the used communication protocol (RTU/ASCII or TCP).
3.1 MODBUS RTU/ASCII
In this section, the table describes the error response structure following to a not-valid query or command.
This table refers to a master-slave communication in MODBUS RTU.
Values contained in Response messages are in hex format.
Structure
Slave address
Function code + $80 (e.g. 03+80, 04+80, 10+80, according to the query/command)
Exception code
CRC
Response example: 018301F080
Exception codes for MODBUS RTU/ASCII are following described:
$01
ILLEGAL FUNCTION: the function code received in the query is not an allowable action.
$02
ILLEGAL DATA ADDRESS: the data address received in the query is not an allowable address
(e.g. the combination of register and transfer length is invalid).
$03
ILLEGAL DATA VALUE: a value contained in the query data field is not an allowable value.
$04
ILLEGAL RESPONSE LENGTH: the request would generate a response with size bigger than that
available for MODBUS protocol.
3.2 MODBUS TCP
In this section, the table describes the error response structure following to a not-valid query or command.
This table refers to a master-slave communication in MODBUS TCP.
Values contained in Response messages are in hex format.
Structure
Transaction ID
Protocol ID
Data bytes
Unit ID
Function code + $80 (e.g. 03+80, 04+80, 10+80, according to the query/command)
Exception code
Response example: 010000000003018301
MODBUS RTU/ASCII, TCP
Example Byte
01
-
83
-
01
-
F0
High
80
Low
Example Byte
01
-
00
High
00
Low
00
High
00
Low
03
-
01
-
83
-
01
-
59