Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Modbus-TCP library


  • Please log in to reply
13 replies to this topic

#1 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 31 March 2012 - 02:46 PM

After a long long period (it calls "delay"), I've just published a library for using Modbus-TCP and UDP (master and slave) with your Netduino (Plus).
I hope to be able to add the RS-485 transport way, but it's much a challenge...
http://highfieldtale...y-for-netduino/
Biggest fault of Netduino? It runs by electricity.

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 31 March 2012 - 09:53 PM

Wow, that is very cool Mario. Thanks for sharing this! Chris

#3 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 09 April 2012 - 03:25 PM

Okay, now the library contains the RTU protocol, which works over RS-485.
It seems pretty easy to realize, so I'd expect should be available for the Go! as well.
http://highfieldtale...t-open-toolbox/
Biggest fault of Netduino? It runs by electricity.

#4 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 21 September 2012 - 05:31 AM

Finally my Modbus library has been listed (as Cet Electronics) in the Technical Resource section of the Modbus Organization site! http://www.modbus.org/tech.php
Biggest fault of Netduino? It runs by electricity.

#5 Coding Smackdown

Coding Smackdown

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts
  • LocationLewisville, TX USA

Posted 21 September 2012 - 04:46 PM

Congratulations! It nice to see something being done here making it into an industry library listing.
Brewing Award Winning Beer with a Netduino!
http://diybrewery.com

#6 bu2002

bu2002

    Member

  • Members
  • PipPip
  • 13 posts
  • LocationDenver

Posted 20 October 2012 - 04:42 PM

Im trying to build a test app with the library but having trouble finding the ModbusServer.cs Anyone have a working example of this for the Netduino Plus?

#7 Pr3ach3rman

Pr3ach3rman

    New Member

  • Members
  • Pip
  • 3 posts

Posted 26 March 2014 - 03:12 PM

I neet to setup Modbus TCP beetween some Netduino 2 Plus boards for a Project and so i found an downloaded this library. My Problem is that i couldnt find any Examples how to include this Library to my programm and i am pretty new at working with Visual C#.

 

Has anyone an Example or link for me?

 

Thank you very much!



#8 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 27 March 2014 - 04:24 AM

I neet to setup Modbus TCP beetween some Netduino 2 Plus boards for a Project and so i found an downloaded this library. My Problem is that i couldnt find any Examples how to include this Library to my programm and i am pretty new at working with Visual C#.

 

Has anyone an Example or link for me?

 

Thank you very much!

 

Hello.

If you have no-at-all or even few experience with C# and Netduino, I'd suggest to begin with something easier. The library is not particularly complex, but it assumes that the developer *knows* how to deal with the framework, the language and the hardware.

Also consider to take practice just without the Netduino first. Try to create some small programs for PC with the Visual Studio Express.

http://www.visualstu...udio-express-vs

 

The repository does include several examples. If you need to deal just with Netduino, here is the sample program where are all-six the different ways to use the library.

http://cetdevelop.co...s_MF/Program.cs

 

That is, if you compile the source as-is, you'll have a TCP-Master Netduino. To create the TCP-Slave counterpart, just un/comment the proper "#define" at the top of the module.

 

What else do you need?


Biggest fault of Netduino? It runs by electricity.

#9 Pr3ach3rman

Pr3ach3rman

    New Member

  • Members
  • Pip
  • 3 posts

Posted 23 April 2014 - 06:50 PM

Thank you for the example!

 

First i had to find out how to add the Library to the Visual Studio and added for MM4.2

So that seems to be ok.

 

Now i am playing around and try to set up the right IP-Adress for my Network which causes some trouble.

  //setup the board IP
  NetworkInterface.GetAllNetworkInterfaces()[0]
          .EnableStaticIP("10.0.0.110", "255.255.255.0", "10.0.0.138");

and the unexpected Output is:

  The local IP address of your Netduino Plus is 192.168.0.99


#10 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 24 April 2014 - 03:29 AM

 

Thank you for the example!

 

First i had to find out how to add the Library to the Visual Studio and added for MM4.2

So that seems to be ok.

 

Now i am playing around and try to set up the right IP-Adress for my Network which causes some trouble.

  //setup the board IP
  NetworkInterface.GetAllNetworkInterfaces()[0]
          .EnableStaticIP("10.0.0.110", "255.255.255.0", "10.0.0.138");

and the unexpected Output is:

  The local IP address of your Netduino Plus is 192.168.0.99

 

 

AFAIK the network IP can be changed via MFDeploy. The utility has a section where you can set the desired IP. I had the same problem.

 

By the way, are you sure that 10.0.0.x is a valid IP? Isn't superseded as mask?


Biggest fault of Netduino? It runs by electricity.

#11 Pr3ach3rman

Pr3ach3rman

    New Member

  • Members
  • Pip
  • 3 posts

Posted 27 April 2014 - 07:48 AM

Hello!

 

10.0.0.110 is a valid IP Adreass and after removing the linebreak in the following codeline

  NetworkInterface.GetAllNetworkInterfaces()[0].EnableStaticIP("10.0.0.110", "255.255.255.0", "10.0.0.138");

it just works fine! I dont realy understand why but its working now.

 

Thank you very much!!!



#12 Alek

Alek

    New Member

  • Members
  • Pip
  • 8 posts
  • LocationMonza

Posted 26 November 2014 - 11:38 AM

Hi Mario

I set up a modbus TCP client, but I'd need to send registers in string format. Could it be done?

 

Thanks

Alessandro


Alek      :)

 

Brained in Italy


#13 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 26 November 2014 - 12:32 PM

Hi Mario

I set up a modbus TCP client, but I'd need to send registers in string format. Could it be done?

 

Thanks

Alessandro

 

Ciao Alessandro.

If you mean Modbus ASCII, then the answer is "no". However, you may create your own codec for such a standard. Have a look at the RTU codecs, and the design is easy enough.

Riciao


Biggest fault of Netduino? It runs by electricity.

#14 Alek

Alek

    New Member

  • Members
  • Pip
  • 8 posts
  • LocationMonza

Posted 26 November 2014 - 01:03 PM

Thanks Mario for ur prompt reply!!

I think I'll convert the string to byte array, send it as a register (or multiregister) and re-compose on server side (scada).

 

Grazie ci

 

Alessandro


Alek      :)

 

Brained in Italy





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.