Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
M

ModbusMaster

> 编程语言
Open source

Enlighten your Arduino to be a Modbus master

646 stars0 likes0 views
WebsiteGitHub

About

Enlighten your Arduino to be a Modbus master

ModbusMaster

Overview

This is an Arduino library for communicating with Modbus slaves over RS232/485 (via RTU protocol).

Features

The following Modbus functions are available:

Discrete Coils/Flags

  • 0x01 - Read Coils
  • 0x02 - Read Discrete Inputs
  • 0x05 - Write Single Coil
  • 0x0F - Write Multiple Coils

Registers

  • 0x03 - Read Holding Registers
  • 0x04 - Read Input Registers
  • 0x06 - Write Single Register
  • 0x10 - Write Multiple Registers
  • 0x16 - Mask Write Register
  • 0x17 - Read Write Multiple Registers

Both full-duplex and half-duplex RS232/485 transceivers are supported. Callback functions are provided to toggle Data Enable (DE) and Receiver Enable (/RE) pins.

Installation

Library Manager

Install the library into your Arduino IDE using the Library Manager (available from IDE version 1.6.2). Open the IDE and click Sketch > Include Library > Manage Libraries…

Scroll or search for ModbusMaster, then select the version of the library you want to install. Quit/re-launch the IDE to refresh the list; new versions are automatically added to the list, once released on GitHub.

Refer to Arduino Tutorials > Libraries Using the Library Manager.

Zip Library

Refer to Arduino Tutorials > Libraries Importing a .zip Library.

Manual

Refer to Arduino Tutorials > Libraries Manual Installation.

Hardware

This library has been tested with an Arduino Duemilanove, PHOENIX CONTACT nanoLine controller, connected via RS485 using a Maxim MAX488EPA transceiver.

Caveats

Conforms to Arduino IDE 1.5 Library Specification v2.1 which requires Arduino IDE >= 1.5.

Arduinos prior to the Mega have one serial port which must be connected to USB (FTDI) for uploading sketches and to the RS232/485 device/network for running sketches. You will need to disconnect pin 0 (RX) while uploading sketches. After a successful upload, you can reconnect pin 0.

Support

Please submit an issue for all questions, bug reports, and feature requests. Email requests will be politely redirected to the issue tracker so others may contribute to the discussion and requestors get a more timely response.

Example

The library contains a few sketches that demonstrate use of the ModbusMaster library. You can find these in the examples folder.

…

Project inspired by Arduino Modbus Master.

License & Authors

  • Author:: Doc Walker ([email protected])
  • Author:: Ag Primatic ([email protected])
  • Author:: Marius Kintel ([email protected])
Copyright:: 2009-2016 Doc Walker

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言