Modbus abnormal response

freeFree Technical Resource

This content is free to read, suitable for basic learning and search traffic.

Modbus abnormal response

Effective Function Code Description (Decimal)

function codeInstructions
01Read coil status
02Read input status
03Read and hold register
04Read input register
05Strong single coil
06Pre set single register
07Read abnormal status
08Return diagnostic verification
09Programming (Only for484)
10Control inquiry
11Read event count
12Read communication event records
13Programming (184/384/484/584Etc.)
14explore
15Strong placement of multiple coils
16Pre set multiple coils
17Report multiple registers
18Can enable the host to simulate programming functions
19Reset communication link
20Read general parameters
21Write universal parameters
22Mask write register
23Read/write multiple registers
43Read device identification code
22-42, 44-64Reserved as an extended feature
65-72Reserved for backup use
73-119Illegal function
120-127Reserve, Reserved for internal use
128-255Reserve, Used for abnormal response

Exception Response

master device (client) Or from the device (Server) Any abnormality in the response should occur, All of them can lead to data processing errors. On the main device (client) After making a request, One of the following events may occur:

  • If from the device (Server) From the main device (client) Received request, There were no communication errors among them, And processed the request correctly, So it will return a normal response.
  • If from the device (Server) Due to a communication error, it was not connected to the main device (client) Receive requests, So it won't return to Shangying. The main device program will eventually process a timeout condition for the request.
  • If from the device (Server) From the main device (client) Received request, But a communication error was detected, So it won't return to Shangying. The main device program will eventually process a timeout condition for the request.
  • If from the device (Server) From the main device (client) Received request, There were no communication errors among them, But I can't handle it (For example, the request is to read a non-existent register) , So the device will return an abnormal response, Notify the main device of any errors that have occurred.

Abnormal frame

An exception frame was sent from the device to the master device, Report abnormal response. An abnormal frame includes four domains:

domaindefinitionsizeInstructions
1From device number1 bytesThe destination address of the request1–247: Unique destination address
2Abnormal function code1 bytesRequestFunction code +128 (0x80)
3Exception coden byteRefer to the next section
4Check2 byteCRC16 (Check for transmission errors)

Exception code

Abnormal response frames have two fields that distinguish them from regular response frames:

  • The abnormal response function code is equal to the original request function code plus 128 (0x80).
  • The exception code depends on the communication error encountered by the device.

The table below introduces the exception codes handled by circuit breakers:

Exception codeNameInstructions
01 (0x01)Illegal functionThe function code received in the request is not an authorized operation from the device. The device may be in an incorrect state, Unable to process specific requests.
02 (0x02)Illegal data addressThe data address received from the device is not an authorized address of the device.
03 (0x03)Illegal data valueThe value in the request data column is not an authorized value from the device.
04 (0x04)From equipment failureFailed to execute a requested operation from the device, Because an irreparable error occurred.
05 (0x05)ConfirmReceived request from device, But it takes a long time to process it.
06 (0x06)Busy with devicesThe device is busy processing another command. The master device must send a request after the slave device is idle.
07 (0x07)Negative confirmationThe slave device is unable to execute the programming request sent by the master device.
08 (0x08)Memory parity check errorDetected a parity error from the storage when attempting to read the expansion memory from the device.
10 (0x0A)Gateway channel unavailableGateway overload, Or not configured correctly.
11 (0x0B)Gateway target device failed to respondThere is no slave device in the network.
Related Tags
Put this resource to use in a real project?

Go to the Tool Center for message parsing, CRC verification and device debugging, or submit your requirements for selection and integration advice.

Engineer Membership

Turn this article into actionable debugging resources

After activation, you can use advanced message parsing, resource pack downloads, code examples, engineering cases and priority technical support, suitable for real project delivery.

Unlimited Advanced Tools
Resource & Code Packs
Complete Engineering Case Library
Priority Technical Support

Leave a Reply

Your email address will not be published. Required fields are marked *.