Function libmodbus_rs::prelude::get_float_abcd
[−]
[src]
pub fn get_float_abcd(src: &[u16]) -> f32
get_float_abcd
- get a float value from 2 registers in ABCD
byte order
The get_float_abcd()
function shall get a float from 4 bytes in usual Modbus format.
The src
slice mut contain two u16
values, for example, if the first word is set to 0x0020
and the
second to 0xF147
, the float value will be read as 123456.0
.
Return value
The function shall return a float.
Parameters
src
- slice of twou16
values
Examples
use libmodbus_rs::prelude::*; assert_eq!(get_float_abcd(&[0x0020, 0xF147]), 123456.0);