1MDU07205-YN rev. F
REF601 CEI
User’s manual
84
7.5 Exception Response
When a client device sends a request to a slave device it expects a normal response.
But, if the slave device cannot handle the request (for example, if the request is to
read a non–existent output or register), it will return an exception response informing
the master of the nature of the error.
The exception response message has two fi elds that differentiate it from a normal
response:
Function Code Field: In a normal response, the server echoes the function code of
the original request in the function code fi eld of the response. All function codes have
a most signifi cant bit (MSB) of 0 (their values are all below 80 hexadecimal). In an
exception response, the server sets the MSB of the function code to 1. This makes
the function code value in an exception response exactly 80 hexadecimal higher than
the value would be for a normal response. With the function code’s MSB set, the
client’s application program can recognize the exception response and can examine
the data fi eld for the exception code.
Data Field: In a normal response, the server may return data or statistics in the data
fi eld (any information that was requested in the request). In an exception response,
the server returns an exception code in the data fi eld. This defi nes the server condition
that caused the exception.
An Example for the same is as below:
Slave
Address
Function
Code
Starting
Address
High
Starting
Address
Low
Quantity
of
resistors
High
Quantity
of
resistors
Low
CRC CRC
01 01 00 01 00 05 CRC CRC
Request format
This creates an exception and the response format is as below:
Slave
Address
Function
Code
Exception
Code
CRC CRC
01 81 01 CRC CRC
Response message format
81h in the starting fi eld indicates that the frame is for exception frame and
exception code 01h indicates that the requested function code is not implemented
in the slave device.
The various exception codes are listed in table 15
Serial Communication