From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus RTU over UDP/IP

I am trying to communicate with a device over Modbus UDP/IP. Here is some of the information I am given from the manufacturer:

 - The module (server) will automatically open UDP port 2001 for receiving data from the client

 - The client in turn must open UDP port 2000 to receive data from the module.

        - This means I need to keep port 2000 open on my machine with LabVIEW trying to access the device?

 - The modbus data packed is wrapped inside of a UDP datagram before being sent over the network.

        - From my understanding, this is just saying its encapsulating the standard serial Modbus RTU frame into a UDP?

 - I am unable to ping the IP address that I have set on the device ( can you ping a UDP address?)

 

I've tried using the example simple UDP as well as some modbus example. I'm not sure how to begin this. I've also created a static IP on the device using their HMI.

 

 

0 Kudos
Message 1 of 5
(3,387 Views)

What LabVIEW code are you using?

 

I've heard of Modbus TCP/IP and RTU.  The LabVIEW Modbus libraries handle them.  I have never heard of Modbus UDP/IP.

 

No you can't ping a UDP address.  There is no such thing as a UDP address.  You can ping an IP address.  So if you can't ping that, either the device is not set up to respond to pings (unlikely) or you have a firewall or some other network routing issue interfering.

0 Kudos
Message 2 of 5
(3,375 Views)

Can I ask if UDP is your only option, and if not, why are you using it instead of TCP/IP?

 

NI has this nice page explaining when you should use UDP, the gist of which is that you only should if you are OK with sometimes missing replies or having your module not get your commands.  In exchange, UDP can be faster and doesn't require an active connection, as it can just be set to broadcast.

 

As for your actual issue, you'd be far better served if you can find a library to handle Modbus that's already made instead of parsing it out yourself in any way.  There are several (3 or 4?) for LabVIEW already, though I don't know if they support UDP.

 

 

0 Kudos
Message 3 of 5
(3,374 Views)

I'm not sure why their controller(server) doesn't perform Modbus TCP communication. They do have a 2nd output port though which is a DB9 RS-232 Modbus RTU serial connection. I was thinking instead of trying to figure out how they do Modbus UDP, I can just get one of those gateways which convert serial Modbus RTU into Modbus TCP/IP.

0 Kudos
Message 4 of 5
(3,337 Views)

@PatrickMiller  ha scritto:

I'm not sure why their controller(server) doesn't perform Modbus TCP communication. They do have a 2nd output port though which is a DB9 RS-232 Modbus RTU serial connection. I was thinking instead of trying to figure out how they do Modbus UDP, I can just get one of those gateways which convert serial Modbus RTU into Modbus TCP/IP.


Hi, 

I have similar issues.

I have to communicate with a controller that uses modbus over udp.

They suggested me to replace the tcp/ip VIs with the same udp ones, but this did not work.

Did actually anyone develope a modbus over udp driver?

Does anyone have an example of that?

thanks,

Andrea

0 Kudos
Message 5 of 5
(3,237 Views)