23 releases (7 stable)

new 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

#70 in Hardware support

Download history 764/week @ 2024-10-07 922/week @ 2024-10-14 912/week @ 2024-10-21 1046/week @ 2024-10-28 933/week @ 2024-11-04 1162/week @ 2024-11-11 1228/week @ 2024-11-18 1103/week @ 2024-11-25 1562/week @ 2024-12-02 1370/week @ 2024-12-09 723/week @ 2024-12-16 271/week @ 2024-12-23 868/week @ 2024-12-30 1334/week @ 2025-01-06 1421/week @ 2025-01-13 1540/week @ 2025-01-20

5,172 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