Function libmodbus_rs::prelude::set_float_badc
[−]
[src]
pub fn set_float_badc(src: f32, dest: &mut [u16])
set_float_badc
- set a float value in 2 registers using BADC
byte order
The set_float_badc()
function shall set a float to 4 bytes in swapped bytes Modbus
format (BADC
insted of ABCD
).
The dest slice must contain two u16
values to be able to store the full result of the conversion.
Parameters
src
- float to 4 bytes (f32
)dest
- slice must contain twou16
values
Examples
use libmodbus_rs::prelude::*; let mut dest = vec![0; 2]; set_float_badc(123456.0, &mut dest); assert_eq!(&dest, &[0x2000, 0x47F1]);