Modbus TCP vs UDP; Modbus TCP vs RTU over RS-485

danw

Lifetime Supporting Member
Join Date
Oct 2004
Location
midwest, USA
Posts
3,422
1. Modbus TCP vs Modbus UDP
There is recent mention of Modbus UDP (Modbus over ethernet, but UDP, not TCP) on this thread.

http://www.plctalk.net/qanda/showthread.php?p=772283#post772283

I found this description on an opensource page:
http://jamod.sourceforge.net/kbase/modbus_udp.html

I have not run into Modbus UDP, but and I'm interested in whether others have and what their experience is.

Does a Modbus TCP server or client care whether the Modbus packet arrives UDP?

Will its response as a TCP packet be acceptable?

In other words, do both ends have to be UDP in order for server/client to play nicely together?

2. Modbus TCP vs RTU (over RS-485)

I prefer TCP because Ethernet (10base T [twisted pair], not 10base2/5 [coaxial]) is inherently isolated and does not require termination resistors or biasing. It does have a shorter distance limitation than RS-485, but with the available plant Ethernet infrastructures, that is less and less of a problem over time. Essentially, plug in Ethernet and if the IP address, subnet mask and gateway are suitable (all configuration, no wiring), the devices talk.

RS-485 is frequently non-isolated, subject to common mode issues, frequently lacks signal ground connections, requires termination, and if biasing is required it is an engineering job to achieve it. It can be a bear just to get 485 devices to talk to one another, even if the cabling distance specs are longer.
 
1. Modbus TCP vs Modbus UDP
In other words, do both ends have to be UDP in order for server/client to play nicely together?

Yes. The two (TCP/UDP) do not mix.

A TCP socket would not see a UDP data packet and vice versa. Different protocols. TCP creates a connection, UDP is connectionless.

An application can open a UDP socket and a TCP socket with the same port number. An incoming data packet would be routed to the correct socket for the protocol/port number.
 
TCP are connected sockets, before being able to send data the client must first connect to a server which has a listening TCP port. Once connected, data can be sent in both directions. Client and server exchange additional packets with CRC bytes to verify the correct transmission of the data.

UDP is instead an unconnected socket, the packets are sent directly to the IP and Port of the listening server without previous connection but there is no confirmation that the data has really been received.

A listening TCP port can only receive TCP connections, the same thing happens for UDP that can only receive UDP packets.

The lack of confirmation negotiation makes UDP faster than TCP and more suitable for high speed data acquisition.
 
Haven't seen modbus udp anywhere.

The solution to ethernet short segment distance (330ft) is single mode fiber.
To me the use for modbus over rs485 or rs422 would be in legacy applications only.
 
Last edited:
There is no official Modbus UDP

TCP/IP is not good for I/O operations we see in industrial applications. For this reason I do not like Modbus/TCP.

Modicon should have defined a Modbus UDP and made it an official specification.

If you write the code for the server and client side you can implement your own Modbus UDP but don't expect it to be compatible with someone else's version of Modbus UDP.

Personally I never use TCP since it is easy to implement UDP and still have the same reliability as long as packets are acknowledge.
 
1) as others have said, TCP and UDP talk along side each other, but not WITH each other. That said, I've never seen a production device that uses it. It may be just one vendor's implementation.

2) I would strongly favor Ethernet over RS485 in almost any application. The length isn't quite as long, but remember it is point to point for Ethernet, vs entire segment length for rs485. I've only run into I've application where rs485 was a technically better solution than Ethernet for a customer, and it involved a combination of long distance, coordinated high speed motion, and the cables needing to be flexible to allow for travel over the distance.

Also, 10baseT is way behind the times. Every device I see is 10/100, if not 100/1000. If you have 10 only, you are looking at seriously outdated equipment.
 
Hi,

Anybody got sample code for modbus UDP in ControlLogix. I have got Modbus TCP and RTU over TCP but now have to implement Modbus UDP.
 
Actually, our customer have various Modbus devices on deep sea ROVs. They want an AOI to send /receive data over UDP. They already have got facility for Modbus TCP and Modbus RTU over TCP which I have designed. Now I am not sure how to add UDP option. I initially thought that only changing the Create socket type to 1 will suffice (without opening connection), but that seems not the case. Also is it possible to send /receive UDP packet from 1 EN2T to another for testing purpose as I don't have UDP device with me.
 

Similar Topics

Hi All, I am familiar with using the Modbus TCP Master Sample Application by Pyramid Solutions. I am wondering if I can use it or need something...
Replies
5
Views
2,012
I came across this project a few days ago and thought it might be of interest: http://code.google.com/p/phpmodbus/ I've been playing with it in...
Replies
0
Views
3,449
If a device has Modbus RTU over serial and Modbus RTO over TCP and Modbus TCP then there is a difference between Modbus RTU over TCP vs Modbus TCP...
Replies
7
Views
350
Hi There. I have PC to get few tags from PLC into C# windows forms application. What is the best and fastest way? I could not find Omron in...
Replies
3
Views
164
I contacted Hach and bought a kit they recommended for a customer to add Modbus TCP capability to his Chlorine Analyzer with a SC4500 controller...
Replies
8
Views
195
Back
Top Bottom