I use NMOdbus framework to work with modbus rtu network, but i can't find any example how to get the code of failed requests.
我使用NMOdbus框架与modbus rtu网络一起工作,但我找不到任何示例如何获取失败请求的代码。
1 个解决方案
#1
0
I assume you mean the exception cause? Like "Illegal Data Address" or "Unsupported Function"?
我猜你是指异常原因吧?比如“非法数据地址”或“不受支持的功能”?
You should receive a SlaveExceptionResponse message whenever the slave device reports a failure. The value you want is SlaveExceptionCode.
当从属设备报告失败时,您应该收到一个SlaveExceptionResponse消息。您需要的值是SlaveExceptionCode。
Here's the relevant class file on GitHub -
这是GitHub上的相关类文件。
SlaveExceptionResponse.cs
#1
0
I assume you mean the exception cause? Like "Illegal Data Address" or "Unsupported Function"?
我猜你是指异常原因吧?比如“非法数据地址”或“不受支持的功能”?
You should receive a SlaveExceptionResponse message whenever the slave device reports a failure. The value you want is SlaveExceptionCode.
当从属设备报告失败时,您应该收到一个SlaveExceptionResponse消息。您需要的值是SlaveExceptionCode。
Here's the relevant class file on GitHub -
这是GitHub上的相关类文件。
SlaveExceptionResponse.cs