- Notifications
You must be signed in to change notification settings - Fork1.8k
A Modbus library for Linux, Mac OS, FreeBSD and Windows
License
stephane/libmodbus
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
libmodbus is a free software library to send/receive data with a device whichrespects the Modbus protocol. This library can use a serial port or an Ethernetconnection.
The functions included in the library have been derived from the Modicon ModbusProtocol Reference Guide which can be obtained fromwww.modbus.org.
The license of libmodbus isLGPL v2.1 or later.
The official website iswww.libmodbus.org. Thewebsite contains the latest version of the documentation.
The library is written in C and designed to run on Linux, Mac OS X, FreeBSD, Embox,QNX and Windows.
You can use the library on MCUs with Embox RTOS.
You will only need to install automake, autoconf, libtool and a C compiler (gccor clang) to compile the library and asciidoc and xmlto to generate thedocumentation (optional).
To install, just run the usual dance,./configure && make install
. Run./autogen.sh
first to generate theconfigure
script if required.
You can change installation directory with prefix option, eg../configure --prefix=/usr/local/
. You have to check that the installation library path isproperly set up on your system (/etc/ld.so.conf.d) and library cache is up todate (runldconfig
as root if required).
The library provides alibmodbus.pc file to use withpkg-config
to ease yourprogram compilation and linking.
If you want to compile with Microsoft Visual Studio, you should follow theinstructions in./src/win32/README.md
.
To compile under Windows, installMinGW and MSYS thenselect the common packages (gcc, automake, libtool, etc). The directory./src/win32/ contains a Visual C project.
To compile under OS X withhomebrew, youwill need to install the following dependencies first:brew install autoconf automake libtool
.
To build under Embox, you have to use its build system.
Some tests are provided intests directory, you can freely edit the sourcecode to fit your needs (it's Free Software :).
Seetests/README for a description of each program.
For a quick test of libmodbus, you can run the following programs in two shells:
- ./unit-test-server
- ./unit-test-client
By default, all TCP unit tests will be executed (see --help for options).
It's also possible to run the unit tests withmake check
.
SeeCONTRIBUTING document.
You can serve the local documentation with:
pip install mkdocs-materialmkdocs serve
About
A Modbus library for Linux, Mac OS, FreeBSD and Windows