LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

question in using tcp/ip modbus protocol

Hi, I have problem in tcp/ip modbus communicating with LTE router.

 

When i use modbus poll  I can get data.

 

IP adress 192.168.10.101 is from LTE router link with LAN.

 

And my notebook address is 192.168.10.200 link to LTE router wi-fi.

 

I changed my firewall ,VI server, and put my code to while loop and for loop too, but  always occured error code 56.

 

I tried tcp protocol too, but same result occured.

 

Please help me...

 

ps. I can get data with serial communication. but can't get data with lan.

q1.PNGq2.PNGq3.PNGq4.PNG

 

 

0 Kudos
Message 1 of 6
(2,470 Views)

Your screenshots of modpoll suggest that you use the protocol Modbus RTU. That protocol has been developed for connections over a serial port.

 

The LabVIEW modbus API that you are using uses Modbus-TCP for its ethernet implementation. This protocol is fundamentally different from Modbus RTU thats why you get an error 56 (The network operation exceeded the user-specified or system time limit) - you just do not get any answer to your Modbus-TCP request as your Modbus slave does not understand that request.

 

Regards

Kudos are welcome...
0 Kudos
Message 2 of 6
(2,447 Views)

Thank you for your  help.

 

But I can get data from router wireless in modbus poll without any serial port...

 

 

 

 

 

 

0 Kudos
Message 3 of 6
(2,411 Views)

I would agree with Jens, Modbus TCP/IP normally has a different message structure that your Modbus library is trying to use. You might need to find a library that supports RTU over TCP/IP or write your own.

 

http://www.simplymodbus.ca/TCP.htm 

 

 

0 Kudos
Message 4 of 6
(2,391 Views)

@StevenD wrote:

You might need to find a library that supports RTU over TCP/IP or write your own.


I've never tried this, but I think you might be able to get this working with the NI Modbus library with minimal changes. The ModbusMaster class contains a TransmissionDataUnit class which has 3 concrete implementations (RTU, ASCII, and IP). If you look inside of the Create TCP Master function you can see that it just uses the IP data unit while the Create Serial Master function can select either RTU or ASCII.

 

Looking through the code, you might be able to just replace the IP data unit class with the RTU data unit. The underlying communication protocol seems to be mostly decoupled from the creation of the ADU so I think making this change would result in sending an RTU packet over TCP.

 

https://github.com/NISystemsEngineering/LabVIEW-Modbus-API

Matt J | National Instruments | CLA
0 Kudos
Message 5 of 6
(2,381 Views)

Another idea on that:

Use a VISA-TCP connection on Modbus RTU, something like: TCPIP::192.168.10.101::502::SOCKET

 

You only have to adept the Open Modbus/Open connections VI, depending on the Modbus API, this usually tries to set some serial settings like baud rate that are not available on a VISA-TCP connection.

 

Regards, Jens

Kudos are welcome...
0 Kudos
Message 6 of 6
(2,346 Views)