modbus

Crates.iomodbus
lib.rsmodbus
version1.1.0
sourcesrc
created_at2015-11-15 14:02:28.724213
updated_at2023-12-20 11:37:50.698283
descriptionPure Rust modbus implementation
homepagehttps://github.com/hirschenberger/modbus-rs.git
repositoryhttps://github.com/hirschenberger/modbus-rs.git
max_upload_size
id3428
size63,311
Falco Hirschenberger (hirschenberger)

documentation

https://hirschenberger.github.io/modbus-rs

README

Rust Modbus

GitHub Workflow Status (with event) Crates.io docs.rs Crates.io License

Modbus implementation in pure Rust.

Usage

Add modbus to your Cargo.toml dependencies:

[dependencies]
modbus = "1.1"

Import the modbus crate and use it's functions:

use modbus::{Client, Coil};
use modbus::tcp;

let mut client = tcp::Transport::new("192.168.0.10");

client.write_single_coil(1, Coil::On).unwrap();
client.write_single_coil(3, Coil::On).unwrap();

let res = client.read_coils(0, 5).unwrap();

// res ==  vec![Coil::Off, Coil::On, Coil::Off, Coil::On, Coil::Off];

See the documentation for usage examples and further reference and the examples directory for a commandline client application.

License

Copyright © 2015-2024 Falco Hirschenberger

Distributed under the MIT License.

Commit count: 161

cargo fmt