C++/C# Free Lib RTU / TCP-IP

posted Oct 20, 2014, 6:34 AM by Javad Taghia   [ updated Oct 20, 2014, 6:34 AM ]
There are some simple and practical free library that will help developers to make PC-based control/monitoring on Modbus. 
There are some commercial ones with high-level support and multi-platform  implementation:

There are two free libraries that I'm aware of and they look comprehensive and outstanding. They come in two different languages: C++ and c#. The former is multi-platform. I don't go through Linux implementation, which I believe it's simple. We are going to use VStudio to build and get modbus.dll and modbus.lib for further implementation. 
There are some steps to follow that comes as follows. Before going to building C++ version let's introduce both:
1. C#: https://code.google.com/p/nmodbus/ is called NModbus and comes with MIT licence. 
2. C++: Libmodbus:
--Linux: http://libmodbus.org/download/
-- Win32: https://github.com/stephane/libmodbus/tree/master/src/win32 (the project is attached, the original for VS2008 and mine:VS2012).

Steps to built Win32 version of Libmodbus:
1. Download the attached file "libmodbus-master.zip" and extract the zip file. 
2. Go to the folder and copy the path at: 
3. In cmd go to the folder win32 within src and write: (you need to have vstudio installed; I'm using 2012) .
4. run configure.js by: cscript configure.js
5. now you got configure.h in the folder and some extra files. 
6. open solution file in the win32 folder. If you use upper version than 2008 you need to upgrade the project so you have your project opened. 
7. go to On the Settings (Project > Settings > Linker) removing the "Version" entry.
and remove version entry if doesn't link properly. 
8. now it should be built and you got two files: modbus.lib; modbus.dll
9. run a test program in test folder.

Javad Taghia,
Oct 20, 2014, 6:34 AM
Javad Taghia,
Oct 20, 2014, 6:34 AM
Javad Taghia,
Oct 20, 2014, 6:34 AM