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: 

Modbus device not working with Labview, but works with Python.

Solved!
Go to solution

Hello,

I have trying to connect a modbus device using Labview but it does not work at all. My previous application uses Python (pymodbusTCP) and it works well.
I have gotten the errors 56 and 66. I suppose it can not be a network problem because it works well with a python script. The address and port is all the same.

Thank you.

0 Kudos
Message 1 of 17
(1,802 Views)

Are you using NI Modbus Library Toolkit for LabVIEW?

You can Performing a Good NI I/O Trace Capture for Debugging/Troubleshooting to debug the data sent and received

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
-------------------------------------------------------
https://github.com/ZhiYang-Ong
0 Kudos
Message 2 of 17
(1,767 Views)

Hi Zyong,

Thank you for replying. I have used so far two libraries, NI Modbus Library and Plasmionique Modbus Master. None of them has worked.
To begin I just would like to read the holding registers from the device.
I have been using Labview 2024 Q1.

 

Best,

Henrique 

 

0 Kudos
Message 3 of 17
(1,751 Views)

Can you share your code for version 2020 ? 

 

0 Kudos
Message 4 of 17
(1,718 Views)

I have been using Labview version 2024 Q1.

0 Kudos
Message 5 of 17
(1,714 Views)

A picture is not code! Why are there terminals without label?

Do you really want to do two things (reading/writing) in parallel with no clue what happens first?

 


@henk1000 wrote:

I have been using Labview version 2024 Q1.

Capture


 

0 Kudos
Message 6 of 17
(1,706 Views)

I have tried also only reading and the result was the same. The program is quite simple so I find it not necessary to post it. If it is really necessary I can post it.

0 Kudos
Message 7 of 17
(1,693 Views)

@henk1000 wrote:

The program is quite simple so I find it not necessary to post it.


Again, a picture of code with unlabeled terminal and coercion dots (e.g. your "register to write" should not be U8) raises a lot of red flags. We also can't tell any of the wire values. Is LabVIEW allowed to use the network? Do you really think you should branch the wire?

 

(disclaimer: I don't do modbus and I am not familiar with your toolkits. Hopefully somebody else will help.)

0 Kudos
Message 8 of 17
(1,689 Views)

Hi,

This is the code.

0 Kudos
Message 9 of 17
(1,676 Views)

The biggest gotcha I usually see is the address, from the NI Modbus documentation:

ShockHouse_0-1719955746808.png

So I would check to make sure the register you want to read is correct.

 

Usually error 56/66 are a a result of the remote application closing the connection. Which could likely happen if the address, or amount of bytes are wrong.

0 Kudos
Message 10 of 17
(1,647 Views)