Namespaces | |
| R421A | |
Classes | |
| struct | ADU |
| class | Device |
| A virtual device, represents a modbus slave device. More... | |
| struct | PDU |
| Protocol Data Unit. More... | |
| class | Request |
Enumerations | |
| enum | Exception { Exception::Success = 0x00, Exception::IllegalFunction = 0x01, Exception::IllegalDataAddress = 0x02, Exception::IllegalDataValue = 0x03, Exception::SlaveDeviceFailure = 0x04 } |
| Modbus exception codes returned in response packets. More... | |
| enum | Function { Function::XX } |
Functions | |
| bool | operator! (Exception exception) |
| String | toString (Exception exception) |
| String | toString (Function function) |
| ErrorCode | readRequest (RS485::Controller &controller, ADU &adu) |
| void | sendResponse (RS485::Controller &controller, ADU &adu) |
Debug print support, outputs contents of packet | |
| size_t | printRequest (Print &p, const PDU &pdu) |
| size_t | printRequest (Print &p, const ADU &adu) |
| size_t | printResponse (Print &p, const PDU &pdu) |
| size_t | printResponse (Print &p, const ADU &adu) |
Enumeration Type Documentation
◆ Exception
|
strong |
Modbus exception codes returned in response packets.
| Enumerator | |
|---|---|
| Success | No exception, transaction completed normally. |
| IllegalFunction | Function not allowed/supported/implemented, or device in wrong state to process request. For example, an unconfigured device may be unable to return register values. |
| IllegalDataAddress | Data address not allowed. More specifically, the combination of reference number and transfer length is invalid. For a controller with 100 registers, the ADU addresses the first register as 0, and the last one as 99. If a request is submitted with a starting register address of 96 and a quantity of registers of 4, then this request will successfully operate (address-wise at least) on registers 96, 97, 98, 99. If a request is submitted with a starting register address of 96 and a quantity of registers of 5, then this request will fail with Exception Code 0x02 "Illegal Data Address" since it attempts to operate on registers 96, 97, 98, 99 and 100, and there is no register with address 100. |
| IllegalDataValue | Data value not allowed. This indicates a fault in the structure of the remainder of a complex request, such as that the implied length is incorrect. It specifically does NOT mean that a data item submitted for storage in a register has a value outside the expectation of the application program, since the MODBUS protocol is unaware of the significance of any particular value of any particular register. |
| SlaveDeviceFailure | Protocol slave device failure exception. An unrecoverable error occurred while the server (or slave) was attempting to perform the requested action. |
◆ Function
|
strong |
Function Documentation
◆ operator!()
◆ printRequest() [1/2]
◆ printRequest() [2/2]
◆ printResponse() [1/2]
◆ printResponse() [2/2]
◆ readRequest()
| ErrorCode IO::Modbus::readRequest | ( | RS485::Controller & | controller, |
| ADU & | adu | ||
| ) |
◆ sendResponse()
| void IO::Modbus::sendResponse | ( | RS485::Controller & | controller, |
| ADU & | adu | ||
| ) |
1.8.13