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

#84 in Hardware support

Download history 407/week @ 2024-12-24 932/week @ 2024-12-31 1208/week @ 2025-01-07 1363/week @ 2025-01-14 1822/week @ 2025-01-21 1928/week @ 2025-01-28 3010/week @ 2025-02-04 2726/week @ 2025-02-11 2729/week @ 2025-02-18 3076/week @ 2025-02-25 2992/week @ 2025-03-04 2736/week @ 2025-03-11 3148/week @ 2025-03-18 2145/week @ 2025-03-25 2116/week @ 2025-04-01 1677/week @ 2025-04-08

9,661 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