LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem Reading Holding Registers Modbus

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 ?  

Download All
0 Kudos
Message 1 of 4
(2,509 Views)

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.


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 4
(2,490 Views)

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?

0 Kudos
Message 3 of 4
(2,471 Views)

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. 

0 Kudos
Message 4 of 4
(2,421 Views)