Question
What is the format of the MWX/MRX exception buffer?
Answer
The instructions require 3 consecutive words.
If a Modbus slave device does not like something in a Modbus request it receives, it will respond with an exception response.
The exception response at the protocol level looks like:
- Byte 1 = Address Byte
- Byte 2 = Function Code of Request with Most Significant Bit Set
- Byte 3 = Exception Code
- Byte 4 and 5 = CRC Error Check Characters
These bytes are swapped in the MRX/MWX exception response buffer V-memory so:
- V-Memory 1 High Byte = Function Code Byte
- V-Memory 1 Low Byte = Address Byte
- V-Memory 2 High Byte = One of the CRC Bytes
- V-Memory 2 Low Byte = Exception Code Bytes
- V-Memory 3 High Byte = 0
- V-Memory 3 Low Byte = Other CRC Byte
The eight exception codes defined by the Modbus protocol are:
- 01 = Illegal Function Code = This slave device does not support the requested function code
- 02 = Illegal Data Address = The requested data address is not valid for this slave device
- 03 = Illegal Data Value = One of the data values in a write request is invalid for this slave device
- 04 = Slave Device Failure = Unrecoverable error in the slave device
- 05 = Acknowledge
- 06 = Slave Device Busy
- 07 = Negative Acknowledge
- 08 = Memory Parity Error
The Exception Response format and error code information comes from this document:
www.modbus.org/docs/PI_MBUS_300.pdf
Starting at page 93 (100 of 121).
FAQ Subcategory: None
This item was last updated on 2011-04-29
Document ID: 1084
The information provided in the AutomationDirect
knowledge base is provided "as is" without warranty of any
kind. AutomationDirect disclaims all warranties, either
express or implied, including the warranties of
merchantability and fitness for a particular purpose. In no
event shall AutomationDirect or its suppliers be liable
for any damages whatsoever including direct, indirect,
incidental, consequential, loss of business profits or
special damages, even if AutomationDirect or its
suppliers have been advised of the possibility of such
damages. Some states do not allow the exclusion of
limitation of liability for consequential or incidental
damages so the foregoing limitation may not apply.