Today is...
Wednesday, June 26, 2019
Welcome to the Modbus Community, about
the world's leading automation protocol.
ModBus C++ source code
Looking for free source code (or examples) of ModBus protocol in C or C++ to establish a communication between a computer (windows or linux) and a measure equipment, that communicates via ModBus protocol...

Hi,

I'm looking for free source code (or examples) of ModBus protocol in C or C++. I would like to establish a communication between a computer (windows or linux) and a measure equipment, that communicates via ModBus protocol. The physical Layer is RS485.

I'm looking forward for a reply.
Gabriel.

By Ben Adams on 27 May, 2003 - 10:23 am

Try

http://pes.free.fr/
http://pes.free.fr/libmodbus.html
http://sourceforge.net/projects/libmodbus/

By Tim Pearson on 14 April, 2019 - 10:46 am

4 Channel DC 12V RS485 Relay Module Modbus. I have a WIN32 version for Visual Studio
https://sourceforge.net/projects/rs485modbus/files

I'm using an RS485 USB adapter, over RS232, Windows 7, WIN32 code will activate the relays. it can also read input data and can send PTZ commands through the serial port to the RS485 inputs of a PTZ camera.

The exact one I tested it with was:
US-RTU 4 way relay module STM8S103
https://www.aliexpress.com/item/MODBUS-RTU-4-way-relay-module-STM8S103-MCU-two-development-RS485-communication-TTL/32870342824.html?spm=a2g0s.9042311.0.0.27424c4dbmNKMq

I needed a RS485 relay controller cos I got a PTZ camera 300 meters on the other side of my property, but I don't like to walk 300 metres, so its activating a 240 volt relay. It can also turn on a bore pump. I have 1 coax and 3 Ethernet running 300 meters to the other side. RS485 just uses 2 strands of Ethernet cable.

Also for open source video capture:
https://sourceforge.net/projects/webcamsmtp/