8 releases
0.4.1 | Feb 19, 2023 |
---|---|
0.4.0 | Jan 14, 2023 |
0.3.1 | Sep 27, 2022 |
0.3.0 | Feb 25, 2022 |
0.1.0 | Sep 14, 2021 |
#1737 in Hardware support
Used in 3 crates
2MB
30K
SLoC
plctag-core
a rust wrapper of libplctag, with rust style APIs and useful extensions.
How to use
Add plctag-core
to your Cargo.toml
[dependencies]
plctag-core= "0.4"
Examples
read/write tag
use plctag_core::{Encode, Decode, RawTag, ValueExt};
let timeout = 100;//ms
let path="protocol=ab-eip&plc=controllogix&path=1,0&gateway=192.168.1.120&name=MyTag1&elem_count=1&elem_size=16";// YOUR TAG DEFINITION
let tag = RawTag::new(path, timeout).unwrap();
//read tag
let status = tag.read(timeout);
assert!(status.is_ok());
let offset = 0;
let value:u16 = tag.get_value(offset).unwrap();
println!("tag value: {}", value);
let value = value + 10;
tag.set_value(offset, value).unwrap();
//write tag
let status = tag.write(timeout);
assert!(status.is_ok());
println!("write done!");
More examples
please take a look at examples
Build
Please refer to How to build to setup build environment.
License
MIT
Dependencies
~0–2.2MB
~45K SLoC