Click here to Skip to main content
15,890,557 members
Articles / Programming Languages / XML
Tip/Trick

Modbus TCP class

Rate me:
Please Sign up or sign in to vote.
4.89/5 (84 votes)
23 May 2014CPOL 1.7M   60.4K   154   171
A Modbus TCP class.

The project has moved to GIT

https://github.com/stephan1827/modbusTCP

Please download and ask questions from there.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Systems Engineer
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionHow to download??? Pin
bubalu10-Jan-14 10:40
bubalu10-Jan-14 10:40 
QuestionModbus TCP Class for VB.net 2008 Pin
The Real John Richards10-Jan-14 0:02
The Real John Richards10-Jan-14 0:02 
AnswerRe: Modbus TCP Class for VB.net 2008 Pin
Stephan Stricker7-Feb-14 8:46
Stephan Stricker7-Feb-14 8:46 
QuestionThanks! Pin
Member 92730099-Jan-14 4:04
Member 92730099-Jan-14 4:04 
QuestionSimple way to run class from console Pin
TadejP8122-Nov-13 11:41
TadejP8122-Nov-13 11:41 
QuestionVS ?? Pin
Member 103773933-Nov-13 5:09
professionalMember 103773933-Nov-13 5:09 
AnswerRe: VS ?? Pin
Flavi114-Nov-13 5:44
Flavi114-Nov-13 5:44 
NewsModbus Framework for .NET Pin
Flavi126-Oct-13 1:29
Flavi126-Oct-13 1:29 
Great job!
Based on your DLL, I have created an entire framework that can be used on any .Net App (windows application).
The DLL I did gives you access to user controls such as buttons, numeric textboxes etc.
The button for example, to use it:
- Drag and drop the button from the VS toolbox.
- Set a few properties (clickable, image_on, image_off, mode, etc...)
- Set the modbus device IP address
- Set the modbus SlaveID
- Set the bit Address

(the image on the button only changes when it gets the confirmation from modbus)

All of this being done at the designer stage (from property panel). No code is required, the control can read/write to that modbus address automatically (for example, a WriteSingleCoil is sent when the button is clicked and set the "clickable").
Using that concept, the Numeric textbox read automatically the values from Modbus (Pull interval is user definable).

Another nice feature is that, if you have a lot of controls in the same page, you don’t want each control to send a request to the Modbus slave to know what value is in his Modbus address. You can disable the AutoReadvalue property and put a master object on your page that will handles the refresh of all the control with one single MODBUS call (the master object on the page send a query and then the response is passed to every controls on the page).

SO, I'd like to share that.
Send me a message so discuss it.
GeneralRe: Modbus Framework for .NET Pin
Member 399685331-Oct-13 6:41
Member 399685331-Oct-13 6:41 
GeneralRe: Modbus Framework for .NET Pin
Flavi18-Nov-13 1:51
Flavi18-Nov-13 1:51 
QuestionIllegal Data Address Pin
softwaremonkey3-Oct-13 3:43
softwaremonkey3-Oct-13 3:43 
AnswerRe: Illegal Data Address Pin
softwaremonkey3-Oct-13 4:16
softwaremonkey3-Oct-13 4:16 
GeneralRe: Illegal Data Address Pin
Mehmet Ali Dalaklı16-Jan-14 7:53
Mehmet Ali Dalaklı16-Jan-14 7:53 
Questionmodbus message response is not receiving in same order Pin
Uma Mahes17-Sep-13 20:10
Uma Mahes17-Sep-13 20:10 
AnswerRe: modbus message response is not receiving in same order Pin
Stephan Stricker18-Sep-13 3:30
Stephan Stricker18-Sep-13 3:30 
GeneralRe: modbus message response is not receiving in same order Pin
Uma Mahes21-Jan-14 1:48
Uma Mahes21-Jan-14 1:48 
SuggestionCan not read/write Address more than 32767. Edited conversion Pin
hadihidayat9-Sep-13 15:52
hadihidayat9-Sep-13 15:52 
GeneralMy vote of 5 Pin
陳志杰25-Aug-13 17:49
陳志杰25-Aug-13 17:49 
SuggestionSome improvements necessary Pin
muharrem27-Jul-13 13:17
muharrem27-Jul-13 13:17 
GeneralRe: Some improvements necessary Pin
Stephan Stricker29-Jul-13 7:10
Stephan Stricker29-Jul-13 7:10 
GeneralRe: Some improvements necessary Pin
muharrem30-Jul-13 4:51
muharrem30-Jul-13 4:51 
Questionasp.net and ModbusTCP class Pin
enfrost15-Jul-13 8:57
enfrost15-Jul-13 8:57 
AnswerRe: asp.net and ModbusTCP class Pin
Stephan Stricker15-Jul-13 11:10
Stephan Stricker15-Jul-13 11:10 
QuestionMore simple sample, please!) Pin
Voodoo902-Jul-13 1:57
Voodoo902-Jul-13 1:57 
NewsModbus TCP Sample (VB.net) Pin
hadihidayat2-Jul-13 0:36
hadihidayat2-Jul-13 0:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.