Function libmodbus_rs::prelude::set_float_dcba [] [src]

pub fn set_float_dcba(src: f32, dest: &mut [u16])

set_float_dcba - set a float value in 2 registers using DCBA byte order

The set_float_dcba() function shall set a float to 4 bytes in swapped bytes Modbus format (DCBA insted of ABCD). The dest slice must contain two u16 values to be able to store the full result of the conversion.

Parameters

Examples

use libmodbus_rs::prelude::*;

let mut dest = vec![0; 2];
set_float_dcba(123456.0, &mut dest);
assert_eq!(&dest, &[0x47F1, 0x2000]);