Function
Retrieves bit information from multiple byte information.
Format
modbus_set_bits_from_bytes( dest , index , nb_bits , tab_byte )
Parameters
dest [ VB.NET: Byte() ] [ C, C++: uint8_t * ] [ C#: byte[] ] [ Python: ctypes.POINTER(ctypes.c_int) ]
Specify the start address of the array that stores the converted bit information.
index [ VB.NET: Integer ] [ C, C++: int ] [ C#: int ] [ Python: ctypes.c_int ]
Specify the start position to set the converted bit information in the dest array.
nb [ VB.NET: UInteger ] [ C, C++: uint ] [ C#: uint ] [ Python: ctypes.c_uint ]
Specify the number of bits to convert.
tab_byte [ VB.NET: Byte() ] [ C, C++: uint8_t * ] [ C#: byte[] ] [ Python: ctypes.POINTER(ctypes.c_uint8) ]
Specify the start address of the array that has stored the data to be converted to bit information.
Return values
None
Remarks
Converts from byte array to bit information. Gets byte information from the beginning of the array and converts it to bit information.
The converted bit information is stored in the array dest. It is possible to store from the position specified by index.
Example
Retrieves the bit array [0, 1, 0, 1] from the byte information array [10, 0, 10, 0].
VB.NET |
Dim dest(4) As Byte Dim tab_byte() As Byte = { 10, 0, 10, 0 } set_bits_from_bytes(dest, 0, 4, value)
|
C, C++ |
uint8_t dest[4]; uint8_t tab_byte[] = {10, 0, 10, 0}; modbus_set_bits_from_bytes( dest, 0, 4, tab_byte );
|
C# |
byte[4] dest = new byte[4]; byte[] tab_byte = { 10, 0, 10, 0 }; modbus.GetByteFromBits(dest, 0, 4, tab_byte);
|
Python |
uint8_buff_type = ctypes.c_uint8 * 4 dest = uint8_buff_type() tab_byte = uint8_buff_type() tab_byte[0], tab_byte[1], tab_byte[2], srtab_byte[3] = (10, 0, 10, 0) modbus.modbus.set_bits_from_bytes(dest, 0, 4, tab_byte)
|