Giter VIP home page Giter VIP logo

modbus-master-slave-for-arduino's Introduction

README.txt

libmodbus is a library that provides a Serial Modbus implementation for Arduino.

A primary goal was to enable industrial communication for the Arduino in order to link it to industrial devices such as HMIs, CNCs, PLCs, temperature regulators or speed drives.

now you can use software serial with the update from Helium6072!

LIBRARY CONTENTS

LICENSE.txt GNU Licence file keywords.txt Arduino IDE colouring syntax

/documentation Library documentation generated with Doxygen.

/examples Sample sketches to implement miscellaneous settings:

/examples/advanced_slave Modbus slave node, which links Arduino pins to the Modbus port. /examples/RS485_slave Modbus slave adapted to the RS485 port /examples/simple_master Modbus master node with a single query /examples/simple_slave Modbus slave node with a link array /examples/software_serial_simple_master Modbus master node that works via software serial

INSTALLATION PROCEDURE

Refer to this documentation to Install this library:

http://arduino.cc/en/Guide/Libraries

Starting with version 1.0.5, you can install 3rd party libraries in the IDE.

Do not unzip the downloaded library, leave it as is.

In the Arduino IDE, navigate to Sketch > Import Library. At the top of the drop down list, select the option to "Add Library".

You will be prompted to select this zipped library.

Return to the Sketch > Import Library menu. You should now see the library at the bottom of the drop-down menu. It is ready to be used in your sketch.

The zip file will have been expanded in the libraries folder in your Arduino sketches directory.

NB : the library will be available to use in sketches, but examples for the library will not be exposed in the File > Examples until after the IDE has restarted.

KNOWN ISSUES

It is not compatible with ARDUINO LEONARDO and not tested under ARDUINO DUE and newer boards.

TODO List

Common to Master and Slave:

  1. Implement other Serial settings: parity, stop bits, ...

  2. End frame delay, also known as T35

  3. Test it with several Arduino boards: UNO, Mega, etc..

  4. Extend it to Leonardo

Master:

  1. Function code 1 and 2 still not implemented

  2. Function code 15 still not implement

  3. Other codes under development

New features by Helium6072 29 July 2016

  1. "port->flush();" changed into "while(port->read() >= 0);"

Since Serial.flush() (port->flush(); in ModbusRtu.h line 287, 337, & 827) no longer empties incoming buffer on 1.6 (Arduino.cc : flush() "Waits for the transmission of outgoing serial data to complete. Prior to Arduino 1.0, this instead removed any buffered incoming serial data.), use "while(port->read() >= 0);" instead.

  1. software serial compatible

New constructor Modbus::Modbus(uint8_t u8id) and method void Modbus::begin(SoftwareSerial *sPort, long u32speed) that makes using software serial possible. Check out sexample "software_serial_simple_master" and learn more!

modbus-master-slave-for-arduino's People

Contributors

alejoseb avatar gabrielssanches avatar krosik avatar luxarts avatar mathiasmoog avatar per1234 avatar smarmengol avatar yichi-yang avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

luke265 rog3r-dev

modbus-master-slave-for-arduino's Issues

need help for dynamic ID

Hello Alextingle,
thank you very much for that improved lib.

I was trying to get a programmable configuration of the modbus settings ID; Boudrate; SerialSetting (for Example.8N1 or 8E1).
Boudrate is easy until 65.000
Serialsettings can be 0x00-0x20 or whatever is possible.

My problem is how can i change the ID if the controller is running without reprogramming.

I write the values in an EEPROM and read it at start, but the Slave slave(ID,Serial1,0) instance was created befor the setup() started.

I set some default values by pressing a button :-).

Can you send me a hint, how i can change the ID at runtime?
I know i should restart the controller after any change.

SOLVED sorry, didn't found slave.setID function

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.