libmodbus | A Modbus library for Linux , Mac OS , FreeBSD and Windows

 by   stephane C Version: v3.1.10 License: LGPL-2.1

kandi X-RAY | libmodbus Summary

kandi X-RAY | libmodbus Summary

libmodbus is a C library. libmodbus has no bugs, it has no vulnerabilities, it has a Weak Copyleft License and it has medium support. You can download it from GitHub.

libmodbus is a free software library to send/receive data with a device which respects the Modbus protocol. This library can use a serial port or an Ethernet connection. The functions included in the library have been derived from the Modicon Modbus Protocol Reference Guide which can be obtained from [] The license of libmodbus is LGPL v2.1 or later. The documentation is available as manual pages (man libmodbus to read general description and list of available functions) or Web pages [] The documentation is licensed under the Creative Commons Attribution-ShareAlike License 3.0 (Unported) (). The official website is [] 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.

            kandi-support Support

              libmodbus has a medium active ecosystem.
              It has 2753 star(s) with 1567 fork(s). There are 214 watchers for this library.
              There were 2 major release(s) in the last 12 months.
              There are 96 open issues and 363 have been closed. On average issues are closed in 527 days. There are 78 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of libmodbus is v3.1.10

            kandi-Quality Quality

              libmodbus has 0 bugs and 0 code smells.

            kandi-Security Security

              libmodbus has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              libmodbus code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              libmodbus is licensed under the LGPL-2.1 License. This license is Weak Copyleft.
              Weak Copyleft licenses have some restrictions, but you can use them in commercial projects.

            kandi-Reuse Reuse

              libmodbus releases are available to install and integrate.
              Installation instructions are available. Examples and code snippets are not available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of libmodbus
            Get all kandi verified functions for this library.

            libmodbus Key Features

            No Key Features are available at this moment for libmodbus.

            libmodbus Examples and Code Snippets

            No Code Snippets are available at this moment for libmodbus.

            Community Discussions


            How to read RS485 Thermometer data with python
            Asked 2021-Oct-13 at 10:37

            The idea of the project is to get the data from the RS485 devices and write it for visualisation later.

            I have raspberry pi 4 with 4GB RAM with this hat and this sensor.

            I'm not sure how should I send and receive the data from the sensor. From its documentation:



            Answered 2021-Oct-13 at 10:37

            This is a textbook example of the software vs. hardware signaling on Modbus.

            Your USB-RS485 provides automatic hardware signaling and it works out of the box. On the other hand, your hat uses one of the serial ports on your RPi and a GPIO line for signaling so you need to either toggle the line yourself within your code (which is, as you have already noticed very inefficient and will not work reliably for most scenarios) or use libmodbus as explained in my answer on the link above.

            Just follow the steps on my answer and make sure you remove any other standard version of the libmodbus library you might have installed before with:



            Libmodbus library not found when trying to compile mbrtu
            Asked 2021-May-04 at 06:32

            I tried:



            Answered 2021-May-04 at 06:32

            It is not a library that is not found by the linker but an include file which is not found by the compiler. Look at the make file install to see how include files are searched. It is likely a variable INC or INCLUDE.



            C - error in compilation with references for hardcoded library
            Asked 2021-Mar-23 at 16:06

            I'm trying to compile a C program that uses the libmodbus library. This library is already installed on the system, that is referenced belong to the modbus.h, which is hardcoded this way on the main:



            Answered 2021-Mar-23 at 16:06

            When linking with an external library, you need to pass in the name of the library with the -l option:



            Unused variable warning even when explicitly using it inside IF statement
            Asked 2020-Dec-17 at 12:58

            I am trying to create (using C++17) a simple debug header that only executes some lines of code if the flag LOGGER_DEBUG_MODE is enabled. This is how my header is defined (I also tried using { x; } instead of x but the warning persists):




            Answered 2020-Dec-17 at 12:58

            You have a header that defines a static bool LOGGER_DEBUG_MODE =true;. If you include that header in multiple C++ files then each file will gets its own copy of that bool.

            In your main.cpp you aren't using R_DEBUG so the copy of that bool (which presumably comes from including logger_adc.h ) is indeed unused in that file.

            Possible solutions are:

            You should make it so you only have a single copy of that bool (declare it in the header with extern and define it in a single C++ file.

            Use build defines instead of runtime checks




            Closing a socket created in a dll
            Asked 2020-Dec-13 at 07:49

            I'm creating a modbus slave using the libmodbus.dll in python on Windows OS. I've used ctypes to load the dll and make use of its features. There is a sample code I'm mimicking here. One of the call's in the dll ends up opening a socket



            Answered 2020-Dec-13 at 07:49

            You can use the socket.close(fd) which takes the socket descriptor and closed it.



            libmodbus: how to compile application including libmodbus library?
            Asked 2020-Jul-29 at 13:47

            I have a problem with compilation of my application, which is based on libmodbus library:

            I have tried to compile it using this command: cc pkg-config --cflags --libs libmodbus modbus.c -o modbus

            But I get the following errors:



            Answered 2020-Jul-29 at 00:39

            Did you install the libmodbus-dev? You should try this: sudo apt-get install -y libmodbus-dev.

            See v3.1.6 and v3.0.8: libmodbus docs


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install libmodbus

            You will only need to install automake, autoconf, libtool and a C compiler (gcc or clang) to compile the library and asciidoc and xmlto to generate the documentation (optional). To install, just run the usual dance, ./configure && make install. Run ./ first to generate the configure 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 is properly set up on your system (/etc/ and library cache is up to date (run ldconfig as root if required). The library provides a libmodbus.pc file to use with pkg-config to ease your program compilation and linking. If you want to compile with Microsoft Visual Studio, you need to install to fill the absence of stdint.h. To compile under Windows, install [MinGW]( and MSYS then select the common packages (gcc, automake, libtool, etc). The directory ./src/win32/ contains a Visual C project. To compile under OS X with [homebrew](, you will need to install the following dependencies first: brew install autoconf automake libtool. To build under Embox, you have to use its build system.


            The documentation is available [online]( or as manual pages after installation. The documentation is based on [AsciiDoc]( Only man pages are built by default with make command, you can run make htmldoc in doc directory to generate HTML files.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone stephane/libmodbus

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link