LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

modbus server hosting array, modbus client reading varying registers

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.

Steffen01_0-1699839936753.png

here the array arrives from the SQL reader, it arrives complete. Only reads every 1000ms

Steffen01_4-1699840280258.png

 

 

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

Steffen01_1-1699840027004.png

Steffen01_3-1699840143480.png

 

 

Steffen01_2-1699840099562.png

 

 

0 Kudos
Message 1 of 3
(672 Views)

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.

Steffen01_1-1699906476844.png

 

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

 

Steffen01_0-1699907998671.png

 

 

0 Kudos
Message 2 of 3
(622 Views)

putting some delays in helped a bit. bit occasionally the modbus read throws error 56

Steffen01_0-1699916300159.png

probe sees 10 values in the array, should be 12

Steffen01_1-1699916357229.png

and it asks the right questions. So how do they end up on the wrong output?

Steffen01_2-1699916618250.png

 

0 Kudos
Message 3 of 3
(604 Views)