22 releases (6 stable)

Uses old Rust 2015

1.1.0 Dec 20, 2023
1.0.5 Nov 10, 2022
1.0.4 Oct 18, 2021
1.0.3 Jul 11, 2019
0.2.0 Nov 27, 2015

#58 in Hardware support

Download history 1823/week @ 2024-01-01 2949/week @ 2024-01-08 2417/week @ 2024-01-15 2781/week @ 2024-01-22 2405/week @ 2024-01-29 1683/week @ 2024-02-05 2641/week @ 2024-02-12 2235/week @ 2024-02-19 2407/week @ 2024-02-26 1882/week @ 2024-03-04 1329/week @ 2024-03-11 1869/week @ 2024-03-18 1704/week @ 2024-03-25 1704/week @ 2024-04-01 1696/week @ 2024-04-08 1690/week @ 2024-04-15

6,821 downloads per month

MIT license

40KB
863 lines

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.

Dependencies

~370KB