GithubHelp home page GithubHelp logo

jaosona / go-modbus Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dpapathanasiou/go-modbus

0.0 1.0 0.0 796 KB

This Go package provides Modbus access for client (master) applications to communicate with server (slave) devices, over both TCP/IP and Serial Line/RTU frame protocols.

License: MIT License

Go 100.00%

go-modbus's Introduction

go-modbus

About

This Go package provides Modbus access for client (master) applications to communicate with server (slave) devices, over both TCP/IP and Serial Line/RTU/ASCII frame protocols.

Note that in modbus terminology, client refers to the master application or device, and the server is the slave waiting to respond to instructions, as shown in this transaction diagram:

Modbus Transaction

This code was originally forked from lubia/modbus and repositioned as a pure client (master) library for use by controller applications.

Installation and Usage

Install the package in your environment with these commands (the RTU code now depends on goserial):

go get github.com/tarm/goserial
go get github.com/dpapathanasiou/go-modbus

Next, build and run the examples:

Enabling the USB Serial Port adapter (RS-232) for RTU/ASCII Access

Slave devices which have USB ports for RTU access will not work immediately upon hot-plugging into a master computer.

For master devices running linux, the USB serial port adapter must be explicitly activated using the usbserial linux kernel module, as follows:

  1. Immediately after plugging in the serial port USB, use dmesg to find the vendor and product ID numbers:
$ sudo dmesg | tail

There should be a line which looks like this:

[  556.572417] usb 3-1: New USB device found, idVendor=04d8, idProduct=000c
  1. Use the usbserial linux kernel module to enable it, using the same vendor and product ID numbers from the dmesg output:
$ sudo modprobe usbserial vendor=0x04d8 product=0x000c
  1. Confirm that the serial port is attached to a specific tty device file:
$ sudo dmesg | tail

There should now be a line like this:

[ 2134.866724] usb 3-1: generic converter now attached to ttyUSB0

which means that the serial port is now programmatically accessible via /dev/ttyUSB0

References

Acknowledgements

go-modbus's People

Contributors

btfak avatar dpapathanasiou avatar adamslevy avatar akatsuhiromihara avatar

Watchers

James Cloos avatar

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.