08-28-2020 01:47 AM
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.
08-28-2020 02:33 AM
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
08-28-2020 05:52 AM
Thank you for your help.
But I can get data from router wireless in modbus poll without any serial port...
08-28-2020 09:59 AM - edited 08-28-2020 10:01 AM
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
08-28-2020 01:55 PM
@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
08-31-2020 02:30 AM
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