23
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 the slave address contained in the protocol
• The checksum (CRC) is not correct
• The instruction from the master is defined incompletely or excessively
• The number of words to read is zero
In these cases, the data request should be sent again after a timeout time of approx. 1 s has elapsed.
Error codes
If the data request from the master has been received by the slave without transmission errors but can-
not be processed, the slave responds with an error code. The following error codes may occur:
• 01 = Invalid function
• 02 = Invalid address or too many words need to be read or written
• 08 = Value is write-protected
Response in case of error
The function code is "OR"-linked with 0x80. As a result, the highest value bit (MSB) is set to 1.
Example
The response contains the error code 08 because the address 0x4802 is write-protected.
Slave address Function XX OR 80h Error code Checksum CRC
1 byte 1 byte 1 byte 2 bytes
Data request:
01 06 48 02 00 01 FE 6A
Slave Write word Word address Word value CRC
Response:
01 86 08 43 A6
Slave OR function Error CRC