05-06-2020 05:42 AM
Hi everybody.
I have a question regarding writing to holding registers using Modbus TCP. I am currently trying to make a VI that can control my SMA Sunny Island Inverter through Modbus TCP.
The reading of values from a holding register works fine with the inverter, but i have met problems when i try to write. Every time I try to write to holding register, Labview returns error 538183. I am kinda new to the program and not sure how to fix it.
Labview version: 17.0.1f1 on Windows 10
Regards
Jonas
05-06-2020 09:03 AM
Did you see that the error message tells you "illegal data value"? The value you wrote is not valid for the server.
You wrote to address 40151. While device manuals will give holding registers an address starting with a 4, the real value you send should not have that prefix. Also, devices start their register addressing at 1 in the manuals, but in reality the Modbus protocol starts with register 0.
So for 40151, drop the 4. Subtract 1. Try writing to address 150.
It is the same situation when reading registers as well. So I don't know how you managed to get it to read successfully like you say you did. Unless you used some other piece of software that accepts the manual's 4xxxx1 addressing on its front panel, and does the conversion behind the scenes to the 0-based address without the prefix.
05-07-2020 05:13 AM
Hi,
Thanks for your help, I have now solved the issue. The address was correct in my case. The issue lied within the number of registers sent with the Modbus. It had to be specified to only send two registers (of 16 bit each), because the address used U32 (32 bit). I have linked a picture which shows the working VI.
Best regards
Jonas
08-10-2021 08:05 AM
Dear Jonas,
I am currently facing the same problem you did a year ago and want to kindly ask you to share the implemented VIs?
Kind regards,
Christopher