libmodbus sends and receives data with Modbus-compatible devices over serial RTU or Ethernet TCP, derived from the Modicon protocol reference.
Overview
libmodbus is a C library for talking to industrial and automation hardware that implements the Modbus protocol. It can use a serial port for RTU or a network connection for TCP transport, with API functions aligned to the Modicon Modbus Protocol Reference Guide.
The project targets Linux, Mac OS X, FreeBSD, QNX, Windows, and Embox, including use on MCUs running Embox RTOS. It ships with pkg-config metadata, optional Visual Studio project files under src/win32, and unit test programs that exercise client and server roles locally.
Official documentation is published on libmodbus.org. The upstream site highlights RTU and TCP support, packaged availability on several operating systems, test coverage, and no mandatory third-party dependencies for the core library. A separate commercial promodbus license exists for vendors who need LGPL-free distribution.
Key features
- Modbus RTU over serial
- Modbus TCP over Ethernet
- C API for clients and servers
- pkg-config integration
- Unit test client and server
- Cross-platform builds
- Embox RTOS support
Use cases
- Integrate Modbus devices in C apps
- Talk to PLCs over serial or TCP
- Build Modbus tooling on Linux or Windows
- Embed Modbus on RTOS firmware