Modbus library


This page is holds my ModbusTCP library for the Arduino. The library gives the program the possibility to be a master, a slave or both on a TCP network.
The Modbus functions 1, 2, 3, 4, 5, 6 15 and 16 are implemented. The port 502 is used as standard.
Please report bugs to me to improve the library.

The library uses a single data space for all the Modbus data. This means that all the Modbus data spaces are overlapping and all starting with 0 (zero). This means that several Modbus functions can reach the same data. The user must assign the correct Modbus address to the data.

This library is started as a spinoff of the Mudbus.h slave library from Dee Wykoff from 2011.


MgsModbus-v0.1.1.zip bugfix


example.zip One arduino as master and another as slave

Extra information

Modbus TCP specifications (.doc)

Modbus TCP specifications (.pdf)

Download old version


GNU Licens

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/