ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read MODBUS Registers

Solved!
Go to solution

It's a USB/Serial converter.

0 Kudos
Message 11 of 32
(3,127 Views)
Solution
Accepted by buickgn

buickgn,

 

This may be a problem with the USB converter/driver.  Suggest you modify your vi to use a VISA Write to write out your known good query string, wait and then read the expected number of bytes and see what happens.

0 Kudos
Message 12 of 32
(3,120 Views)

Wayne,

 

It works fine with the Modbus Poll program which leads me to believe it's not a driver issue. I tried your suggestion here:

modbus1.png

 

It sends the right command, however, in the "Read Buffer" it just repeats the command I sent.

0 Kudos
Message 13 of 32
(3,112 Views)

buickgn,

 

I don't think you need the carrige return on the end of the write string.

0 Kudos
Message 14 of 32
(3,105 Views)

You're right, I got rid of that. Still repeating the request. Here's a screenshot of the trace:

 

Trace.jpg

0 Kudos
Message 15 of 32
(3,102 Views)

Is the written command being echo'd by the serial adapter?  What happens if you try to read more characters with the simple read/write string vi?

Message 16 of 32
(3,092 Views)

If I set it to 17, I get: 0203 0002 0002 65F8 0203 0439 0F7F 7394 79. Anything larger than 17 and it throws a timeout.

0 Kudos
Message 17 of 32
(3,088 Views)

Wayne,

 

That was the issue, it's sending back the correct response after it echos the request. I guess the Modbus library doesn't play nice with this particular usb/serial converter!

0 Kudos
Message 18 of 32
(3,085 Views)

Can you disable the echo?  Any driver settings?

0 Kudos
Message 19 of 32
(3,081 Views)

It doesn't look like it. I'm in device manager looking at all the settings and don't see anything to enable/disable the echo.

0 Kudos
Message 20 of 32
(3,079 Views)