Skip to content

Modbus TCP client library to interact with Modbus servers such as PLCs.

License

Notifications You must be signed in to change notification settings

goddland16/Modbus-TCP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

Overview

This is an Arduino library for communicating with Modbus server over Ethernet (via TCP protocol). Arduino will act as a Modbus client and request data from Modbus Server(which could be any device or PLC).

Hardware

This library has been tested with an Arduino Mega with following Compatible Ethernet ICs.

  1. Wizent W5100 - Ethernet library.
  2. ENC28J60 - UIPEthernet library.
  3. ESP8266 - ESP8266 library.

Note: It can be made compatible with Wiznet W5500 model, by adding new Ethernet2 library in the header file.

Settings

Depending on the ic used set the following Macros.

  1. define WIZNET_W5100 = 0
  2. define ENC28J60 = 0
  3. define ESP8266 = 1

Features

The following Modbus functions have been implemented:

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