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

#109 in Hardware support

Download history 1799/week @ 2024-07-29 1340/week @ 2024-08-05 1713/week @ 2024-08-12 1641/week @ 2024-08-19 1509/week @ 2024-08-26 1900/week @ 2024-09-02 1484/week @ 2024-09-09 1108/week @ 2024-09-16 1736/week @ 2024-09-23 1089/week @ 2024-09-30 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 1116/week @ 2024-11-11

4,023 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

~365KB