A modbus RTU and TCP driver for erlang
Latest commit 2583d1c Nov 16, 2011 @ctennis include a license, MIT
Failed to load latest commit information.
include Initial commit Feb 4, 2010
src Handle integer OrigData Feb 5, 2010
.gitignore Initial commit Feb 4, 2010
Emakefile Initial commit Feb 4, 2010
LICENSE include a license, MIT Nov 16, 2011
Makefile Initial commit Feb 4, 2010
README Update README with into on conversion function Feb 4, 2010


This is an erlang modbus driver.  It allows you to communicate with remote modbus speaking devices using erlang via TCP sockets.

Two types of devices are supported, Modbus RTU and Modbus TCP.  Modbus RTU is encapsulated over TCP to a remote device, using an ethernet to RS485 converter (I personally like the SENA PS110).

Note that Modbus TCP and Modbus RTU-over-TCP have different message formatting requirements, hence you must specify whether you are connecting to an RTU client or a TCP client during the connect phase.

Most Modbus TCP clients listen on port 502.  The SENA PS110 module I use for Ethernet-to-RS485 conversion listens on port 7001.

To invoke:

	modbus_device:connect(some_device, rtu, "", 7001, 1),
	Value = modbus_device:read_hreg(some_device, 5),

Will read holding register #5 and return the value.  You can also write to a holding register, or read input registers.

You can also pass in a conversion function if you want to get back translated/non-numeric values:

	int_to_bool(1) -> "true";
	int_to_bool(0) -> "false".

	Value = modbus_device:read_hreg(some_device, 5, fun int_to_bool/1).


Read/write coils
Better error handling
More documentation.