2 minute read

Exception Responses

CYCLIC REDUNDANCY CHECK

The CYCLIC REDUNDANCY CHECK (CRC) algorithm checks the contents of the entire message. The CRC field consists of a 16–bit value, and is appended to the end of the message. When this is done, the low–order byte of the field is appended first, followed by the high–order byte. The CRC high–order byte is the last byte to be sent in the message. The CRC value is calculated by the sending device, which appends the CRC to the message. The receiving device recalculates a CRC using the same algorithm during receipt of the message, and as it receives the CRC field, compares the calculated value to the received value. If the two values are not equal, the message is discarded. A detailed description as well as sample code and a calculation example are given in the Modbus Serial Line Implementation Guide version 1.0 or the most current version, available at www.modbus.org.

EXCEPTION RESPONSES

Upon a parity or CRC error, the byte or message (respectively) is discarded. If neither of these errors occurs, the read/write status is checked. An EXCEPTION RESPONSE will be sent if there is a read/write error. If the register cannot be read from or written to at a particular time due to some application software state, it will not generate an Exception Response. Instead, the application layer will respond with data that is in the Fault Identifiers (FID) range. An Exception Response contains a function code that is related to the function code the EMCP 3 GSC is responding to; it’s value is [128 + Function Code for Query]. Any function code 128 ($80) or higher is an Exception Response.

128+ ($80 AND ABOVE) – EXCEPTION RESPONSE TO UNSUPPORTED QUERIES

The EMCP 3 GSC does not support any function codes not listed above in the Supported Function Codes Chapter. Such queries will return an exception response with this exception code.

EXCEPTION CODE REASON

01 Unsupported function code

131 ($83) – EXCEPTION RESPONSE TO READ REGISTERS QUERY

The exception response contains only 1 byte of data, which is comprised of the exception code.

EXCEPTION CODE REASON

02 Starting or ending (starting + count) register address invalid 03 Register Count was less than 1 or greater than 123 04 Read error possibly due to some register(s) in the span not being Read registers

134 ($86) – EXCEPTION RESPONSE TO WRITE SINGLE REGISTER QUERY

The exception response contains only 1 byte of data, which is comprised of the exception code.

EXCEPTION CODE REASON

02 Register address invalid 03 Register value out of range perhaps because longer than 2 bytes 04 Write error possibly due to not being a Write register

This article is from: