mode_bus
mode_bus
### Description
This package is a go implementation of the modbus protocol.
It aims to provide a simple-to-use, high-level API to interact with modbus
devices using native Go types.
Please note that UDP transports are not part of the Modbus specification.
Some devices expect MBAP (modbus TCP) framing in UDP packets while others
use RTU frames instead. The client support both so if unsure, try with
both udp:// and rtuoverudp:// schemes.
```golang
import (
"github.com/simonvetter/modbus"
)
func main() {
var client *modbus.ModbusClient
var err error
if err != nil {
// error out if client creation failed
}
### Supported function codes, golang object types and endianness/word ordering
Function codes:
* Read coils (0x01)
* Read discrete inputs (0x02)
* Read holding registers (0x03)
* Read input registers (0x04)
* Write single coil (0x05)
* Write single register (0x06)
* Write multiple coils (0x0f)
* Write multiple registers (0x10)
Go object types:
* Booleans (coils and discrete inputs)
* Bytes (input and holding registers)
* Signed/Unisgned 16-bit integers (input and holding registers)
* Signed/Unsigned 32-bit integers (input and holding registers)
* 32-bit floating point numbers (input and holding registers)
* Signed/Unsigned 64-bit integers (input and holding registers)
* 64-bit floating point numbers (input and holding registers)
### Dependencies
* [github.com/goburrow/serial](https://github.com/goburrow/serial) for access to
the serial port (thanks!)
### License
MIT.