RModBus Build Status

RModBus - free implementation of protocol ModBus written in pure Ruby.

Features

Support functions

Installation

Download and install RModBus with the following

$ gem install rmodbus

Example

    require 'rmodbus'

    ModBus::TCPClient.new('127.0.0.1', 8502) do |cl|
      cl.with_slave(1) do |slave|
        # Read a single holding register at address 16
        slave.holding_registers[16]

        # Write a single holding register at address 16
        slave.holding_registers[16] = 123

        # Read holding registers 16 through 20
        slave.holding_registers[16..20]

        # Write holding registers 16 through 20 with some values
        slave.holding_registers[16..20] = [1, 2, 3, 4, 5]
      end
    end

GitHub

You can checkout source code from GitHub repositry

$ git clone git://github.com/flipback/RModBus.git

Reference

Home page: http://rmodbus.flipback.net

RModBud on GitHub: http://github.com/flipback/RModBus

ModBus community: http://www.modbus-ida.org