You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is not exactly clear at which point you want to get exception.
As of Modbus specification EX_ILLEGAL_ADDRESS is returned to master on non-existent address. If you want to override this behaviour you can use onRaw() callback but much easier is to modify the library code for this specific case.
If you want to block addReg() from adding registers on some condition you have to inherit own class from ModbusRTU and override addReg() implementation.
mb.slave(SLAVE_ID);
mb.addHreg(REGN);
mb.Hreg(REGN, 100);
....................... if(REGN > 150){"send exeption -3 illegal value"}; // how to do this? ..............
}
void loop() {
mb.task();
yield();
}
The text was updated successfully, but these errors were encountered: