10-01-2019 05:08 AM
Hello everyone.
So I've got this problem with the function "Read Holding Registers" with Modbus RTU.
My program sends a temperature value to an incubator via Modbus RTU and so far it works perfectly because I can see the value on its screen. But when I try to read the register on which I've written the temperature (x47), I only get a "0".
I verified the Modbus connection with "Real Term" and it also works perfectly.
I Simulated the Slave Modbus using "Modbus Slave" and executed the program. It worked perfectly.
So writing on the Incubator's register is possible, simulating writing and reading is also possible, Modbus connection works perfectly, but I cannot Read the Holding Registers . As a Library I use the NI Modbus 1.2.1.
Has anyone had the same problem before ?
10-01-2019 06:00 AM
What I don't understand is why you would open and close the VISA Session more than once.
HINT: Try opening it only once, doing all the nice stuff like writing and reading using the same session, then closing it at the end.
10-01-2019 07:09 AM
Big issue I see:
Did you wire up all the important terminals on your Write and Read SubVI's?
On your read, you wired up the serial parameters as RTU and slave address 1. On your Write, you didn't wire up anything. It is going to use the default, which happens to be RTU and slave address 0. That's talking to two different devices! Actually a bit more complicated because 0 isn't really a valid slave address, but can be used as a broadcast message. So does your device actually recognize messages to it when they are addressed as 0?
10-12-2019 07:31 AM
Thank you for your answers 😄 . The program works perfectly now .
It turned out that the real slave ID was 1 and that I was reading the 0.