11-12-2023 07:53 PM
Good day,
I am trying to simulate a modbus server (formerly known as slave). It reads an array of data from a database, progressing with time (playing back a recording so to speak). Say register 40 000 t0 40 042. That part works fine.
here the array arrives from the SQL reader, it arrives complete. Only reads every 1000ms
Now the client, (formerly known as master) would read some or all registers. In my case it mixes up the results, sometimes register 20-30 appear in the 0-10 array. This setup works firn with a real modbus device, but with simulated server there seem to be issues. Acc to ioninja the conversation is pretty messy, lots of errors
11-13-2023 02:36 PM - edited 11-13-2023 02:40 PM
now I tested on 2 PCs, instead of just using two COM ports on one. Turned out while the PC that played back the data, has already reached the end of the data, the other was still displaying things coming in. So thee must be some long buffer. 1 problem solved, had to reduce the read and write bytes, now it works better. Still e bit erroneous, but I get a response most of the time.
now the funny thing is, first should be the array with 10 values, then the one with 12. So it just spits out what comes first? At least it is consistent and always in the same order
11-13-2023 05:05 PM
putting some delays in helped a bit. bit occasionally the modbus read throws error 56
probe sees 10 values in the array, should be 12
and it asks the right questions. So how do they end up on the wrong output?