3 Modbus protocol description
3.9
Error messages
3.9.1
Modbus error codes
The slave device does not respond
The slave will not respond in the following cases:
•
The baud rate and/or data format of the master and slave do not match.
•
The used device address does not match with the slave address contained in the protocol.
•
The checksum (CRC) is not correct.
•
The instruction from the master is incomplete or over-defined.
•
The number of words to be read is zero.
In these cases, the data request should be sent again after a time-out time of 2 s has elapsed.
Error codes
If the data request of the master has been received by the slave without transmission errors
but could not be processed, the slave will respond with an error code. The following error codes
may occur:
•
01 = Invalid function
•
02 = Invalid address or excessive number of words or bits are to be read or written
•
03 = Value is outside of the permissible range
•
08= Value is write-protected
Response in case of error
Slave address
The function code is ORed with 0x80. This sets the highest-value byte (msb) to 1.
Example
Data request:
01
Slave
Response (with error code 2):
01
Slave
Response with error code 08, because address 0x1636 is write-protected.
42
Function XX OR 80h
1 byte
06
Write word
86
Function OR
1 byte
1636
0001
Word address
Word value
08
43A6
Errors
CRC
Error code
1 byte
FCA2
CRC
Checksum CRC
2 bytes