I have the following in my custom ISlaveDatStote:
public TPoint[] ReadPoints(ushort id, ushort numberOfPoints)
{
_logger.LogDebug($"Received request to read registers with Id {id} and number of points {numberOfPoints}");
// this is the start of the register you are reading from
if (!_dataPollingService.DataMappings.TryGetValue(id, out var mapping))
{
throw new SlaveException($"register {id} does not exist in the mappings file.");
}
}
How can I throw an exception with the specific error response code in modbus? I want to differentiate between invalid address and invalid data value?
I have the following in my custom ISlaveDatStote:
How can I throw an exception with the specific error response code in modbus? I want to differentiate between invalid address and invalid data value?