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 1073/week @ 2024-11-01 1034/week @ 2024-11-08 1283/week @ 2024-11-15 1244/week @ 2024-11-22 1225/week @ 2024-11-29 1629/week @ 2024-12-06 743/week @ 2024-12-13 364/week @ 2024-12-20 630/week @ 2024-12-27 1304/week @ 2025-01-03 1319/week @ 2025-01-10 1316/week @ 2025-01-17 2186/week @ 2025-01-24 2568/week @ 2025-01-31 2974/week @ 2025-02-07 950/week @ 2025-02-14

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

~365KB