Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Fri Nov 24, 2017 6:11 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Modbus Slave UDP support
PostPosted: Thu May 04, 2006 12:54 pm 
Offline

Joined: Thu May 04, 2006 12:46 pm
Posts: 1
Any chance of extending the Modbus slave object to support UDP packets?



I have a Modbus TCP system that I am trying to interface with that uses UDP packets (because of lesser overhead).



All it requires is that the slave listen at port 502 for both TCP connections and UDP packets.



If it gets a UDP packet it just performs the requested command and rather than send it back over a TCP connection it sends the reply via a UDP packet to the originating IP address and port of the incoming UDP packet.



Or is there any way for me to get the source of the Qlarity Modbus slave object and extend it myself?



Charlie


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 04, 2006 1:06 pm 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
Uggh, this may not be pretty.



I have never heard of Modbus implemented over UDP which is the main reason that the Modbus object does not suppor that natively.



You can attempt to hack UDP support into the Modbus communication object. The main issue I see would be the case of a dropped packet. The Modbus object assumes that it has a reliable TCP connection has has no checking for dropped or out-of-order packets.



You already have the source to the modbus object. You can view it but selecting Edit->Edit Libraries and selecting the Modbus Library, then selecting the MBComV2 object and double clicking.



If you wish to edit the source code, I recommend that you import it into your workspace rather than attempt to edit it within the library. Do do that, select Edit->Add/Edit Templates, and click [New Template]. Select "Copy the code of an existing template in a library", then select the MBComV2 object. It should be fairly straightforward to find where the call to NetOpen function call and change it to use NET_UDP instead of NET_TCP.



[Edit]: What I suggested assumes that your UDP version of modbus is treated as a data stream instead of packet data. In other words, the actual bytes transmitted and received must be identical to Modbus TCP. "Modbus UDP" may not take advantage of the automatic packetization that UDP provides.

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group