Hi Tim,
yes, in my initial statement I mentioned the problem with the serial
buffer, I was so surprised that you told me that it is working that I
thought that there would be some internal resource management :-)))
But, in the meantime I have also almost same solution found as you
described above.
Modifications:
- The listen() function is always reading the request and in case of
correct slaveID the response is getting created independent of the
slaveID itself, so by removing the if case where the slaveID is
checked, the slave(s) always response correctly :-)
- But I also added a slaveID array, so that my slave is just
responding to configured slave id's
- Next step planned was actually like you described a DataStore array
for all the configured slave id's, but I found another solution. By
using the ModbusSlaveRequestReceived() event I can switch dependent on
the slave id between defined datastores. So the datastores are
currently not part of the slave, but it is working properly so far.
But, maybe I will also add the datastore array to have it completed.
Thanks Tim for your contribution, any more ideas :-)
Regards,
mj