modbus

Pure Rust modbus implementation

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
Download history 1771/week @ 2024-06-21 1558/week @ 2024-06-28 1492/week @ 2024-07-05 1683/week @ 2024-07-12 1470/week @ 2024-07-19 2262/week @ 2024-07-26 1320/week @ 2024-08-02 1758/week @ 2024-08-09 1355/week @ 2024-08-16 1704/week @ 2024-08-23 1441/week @ 2024-08-30 2034/week @ 2024-09-06 937/week @ 2024-09-13 1865/week @ 2024-09-20 1135/week @ 2024-09-27 885/week @ 2024-10-04

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

~360KB