gbisheimer / modbus-esp8266

Most complete Modbus library for Arduino. A library that allows your Arduino board to communicate via Modbus protocol, acting as a master, slave or both. Supports network transport (Modbus TCP) and Serial line/RS-485 (Modbus RTU). Supports Modbus TCP Security for ESP8266/ESP32.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Modbus Library for Arduino

ModbusRTU, ModbusTCP and ModbusTCP Security

If the library is helpful for your projects you can support it by a glass of beer paypal

For detailes on the library usage visit documentation section.

Features

  • Supports all Arduino platforms
  • Operates in any combination of multiple instances of
  • Reply exception messages for all supported functions
  • Modbus functions supported:
    • 0x01 - Read Coils
    • 0x02 - Read Input Status (Read Discrete Inputs)
    • 0x03 - Read Holding Registers
    • 0x04 - Read Input Registers
    • 0x05 - Write Single Coil
    • 0x06 - Write Single Register
    • 0x0F - Write Multiple Coils
    • 0x10 - Write Multiple Registers
    • 0x14 - Read File Record
    • 0x15 - Write File Record
    • 0x16 - Mask Write Register
    • 0x17 - Read/Write multiple registers
  • Callbacks for
    • Client connect (Modbus TCP)
    • Server/Client disconnect (Modbus TCP)
    • Read specific Register
    • Write specific Register
    • Transaction result (Client side)
    • Transaction start/end (Server side)

Notes

  1. The offsets for registers are 0-based. So be careful when setting your supervisory system or your testing software. For example, in ScadaBR offsets are 0-based, then, a register configured as 100 in the library is set to 100 in ScadaBR. On the other hand, in the CAS Modbus Scanner offsets are 1-based, so a register configured as 100 in library should be 101 in this software.
  2. RS-485 transivers based on MAX-485 is working on at least up to 115200. XY-017/XY-485 working only up to 9600 for some reason.

For more information about Modbus see:

Last Changes

// 4.0.0-DEV
+ ModbusTLS: Modbus TCP Security Client/Server
+ ModbusTLS: ESP8266 Client/Server
+ Test: TLS ESP8266 Client/Server
+ Examples: TLS added
+ ModbusTLS: ESP32 Client
+ Build with no STL dependency
+ Test: No-STL mode
+ ModbusTCP: ModbusEthernet - W5x00 Ethernet library support
+ Test: W5x00 support
+ API: Implementation code merge
+ API: Access ModbusTCP server by name
+ API: Set local multiple registers from an array
+ ModbusIP => ModbusTCP
+ 0x14 - Read File Records function
+ Test: 0x14
+ 0x15 - Write File Records function
+ Test: 0x15
+ Examples: FW update
- Test: FW update
+ 0x16 - Write Mask Register function
+ Test: 0x16
+ 0x17 - Read/Write Registers function
+ Test: 0x17
+ API: Access control callback for individual Modbus function
+ Documentation: Update
+ Remove unneeded register count check in private functions
+ Check startreg + numreg < 65535
+ ModbusRTU: ESP32 SoftwareSerial support
+ ModbusRTU: Fix transaction callback remains assigned after request end
+ ModbusTCP: Free server connection in destructor
+ Declare global registers and callbacks as static members
+ ModbusRTU: Refactor .task() for more relaibe processing of incoming data
+ API: Declare all callbacks as std::function (for STL)
+ API: Master/Slave => Client/Server according to [PRESS RELEASE](https://modbus.org/docs/Client-ServerPR-07-2020-final.docx.pdf)
// 4.1.0
- ModbusTLS: ESP32 Server
- Test: TLS ESP32 Server
- Test: TLS ESP32 Client
- Examples: TLS Certificate test Role extension and Alt-Name
- Examples: TLS Add example explanation
- ModbusRTU: Static buffer allocation.
- Buffer/packet size limitation support
- Slave/Server: slavePDU use early exit by return where possible
- Master/Client: Check frame size against header data where possible
- Master/Client: Additional responce data validation
- Free global registers and callbacks on remove last Modbus instance
- Test: Frame accuracy to specefication
- Test: push/pull functions
- Test: W5x00 with Ethernet library v1
- Examples: Basic file operations
- Examples: Revising

Contributions

https://github.com/emelianov/modbus-esp8266

a.m.emelianov@gmail.com

Original version:

https://github.com/andresarmento/modbus-esp8266

https://github.com/andresarmento/modbus-arduino

prof (at) andresarmento (dot) com

License

The code in this repo is licensed under the BSD New License. See LICENSE.txt for more info.

About

Most complete Modbus library for Arduino. A library that allows your Arduino board to communicate via Modbus protocol, acting as a master, slave or both. Supports network transport (Modbus TCP) and Serial line/RS-485 (Modbus RTU). Supports Modbus TCP Security for ESP8266/ESP32.

License:Other


Languages

Language:C++ 89.0%Language:C 11.0%