modbus_set_float_abcd


 

Function

 

Converts the specified float value to 4-byte data. The byte order is in ABCD order.

 

Format

 

modbus_set_float_abcd( value , dest )

 

Parameters

 

value [ VB.NET: Single ] [ C, C++: float ] [ C#: float ] [ Python: ctypes.c_float ]

Specify the conversion data.

 

dest [ VB.NET: UShort ] [ C, C++: uint16_t * ] [ C#: ushort[] ] [ Python: ctypes.POINTER(ctypes.c_uint16) ]

Specify the pointer of the array that stores the float conversion result.

The premise is that the number of elements in the array is two, and each contains 16-bit data.

 

Return values

 

None

 

Remarks

 

Converts the specified float value to 4-byte data. The byte order is in ABCD order.

The premise is that the dest array has two elements and each has a 16-bit value.

 

Example

 

Gets 4-byte data from the float value.

 

VB.NET

Dim dest(2) As UShort

modbus_set_float_abcd( 123456.0, dest )

 

C, C++

uint16_t dest[2];

modbus_set_float_abcd( 123456.0, dest );

 

C#

ushort[] dest = new ushort[2];

value = modbus.SetFloatAbcd( 123456.0, dest );

 

Python

uint16_buff_type = ctypes.c_uint16 * 2

dest = uint16_buff_type()

value = modbus_set_float_abcd( 123456.0, dest )