23 releases (7 stable)

1.1.1 Jan 24, 2025
1.1.0 Dec 20, 2023
1.0.5 Nov 10, 2022
1.0.4 Oct 18, 2021
0.2.0 Nov 27, 2015

#67 in Hardware support

Download history 1402/week @ 2024-12-08 716/week @ 2024-12-15 285/week @ 2024-12-22 859/week @ 2024-12-29 1340/week @ 2025-01-05 1420/week @ 2025-01-12 1548/week @ 2025-01-19 1969/week @ 2025-01-26 2970/week @ 2025-02-02 2897/week @ 2025-02-09 2475/week @ 2025-02-16 2799/week @ 2025-02-23 3301/week @ 2025-03-02 2561/week @ 2025-03-09 3090/week @ 2025-03-16 2407/week @ 2025-03-23

11,607 downloads per month

MIT license

41KB
863 lines

Rust Modbus

Rust 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-2025 Falco Hirschenberger

Distributed under the MIT License.

Dependencies

~370KB