Fork me on GitHub
v3.0.4 v3.1.0

libmodbus

A Modbus library for Linux, Mac OS X, FreeBSD, QNX and Win32

libmodbus is a free software library to send/receive data according to the Modbus protocol. This library is written in C and supports RTU (serial) and TCP (Ethernet) communications.

The license of libmodbus is LGPL v2.1+ and the licence of programs in the tests directory is GPL v3.

For now, the entry point of the documentation in HTML is Libmodbus Documentation. See the Wiki for general informations.

Code Sample

  modbus_t *mb;
  uint16_t tab_reg[32];

  mb = modbus_new_tcp("127.0.0.1", 1502);
  modbus_connect(mb);

  /* Read 5 registers from the address 0 */
  modbus_read_registers(mb, 0, 5, tab_reg);

  modbus_close(mb);
  modbus_free(mb);

External Documentation