easymodbus/modbusClient.py
def convert_float_to_two_registers(floatValue, register_order=RegisterOrder.lowHigh):
    """
    Convert 32 Bit real Value to two 16 Bit Value to send as Modbus Registers
    floatValue: Value to be converted
    return: 16 Bit Register values int[]
    """
    myList = list()
    s = bytearray(struct.pack('<f', floatValue))  # little endian
    myList.append(s[0] | (s[1] << 8))  # Append Least Significant Word
    myList.append(s[2] | (s[3] << 8))  # Append Most Significant Word
    if register_order == RegisterOrder.highLow:
        myList[0] = s[2] | (s[3] << 8)
        myList[1] = s[0] | (s[1] << 8)
    return myList

    Convert 32 Bit real Value to two 16 Bit Value to send as Modbus Registers
    floatValue: Value to be converted
    return: 16 Bit Register values int[]
    
Convert 32 Bit real Value to two 16 Bit Value to send as Modbus Registers
floatValue: Value to be converted
return: 16 Bit Register values int[]
Convert 32 Bit real Value to two 16 Bit Value to send as Modbus Registers floatValue : Value to be converted return : 16 Bit Register values int []
def convert_float_to_two_registers(floatValue, register_order=RegisterOrder.lowHigh):
    myList = list()
    s = bytearray(struct.pack('<f', floatValue))  
    myList.append(s[0] | (s[1] << 8))  
    myList.append(s[2] | (s[3] << 8))  
    if register_order == RegisterOrder.highLow:
        myList[0] = s[2] | (s[3] << 8)
        myList[1] = s[0] | (s[1] << 8)
    return myList
def convert_float_to_two_registers ( floatValue , register_order = RegisterOrder . lowHigh ) : myList = list ( ) s = bytearray ( struct . pack ( '<f' , floatValue ) ) myList . append ( s [ 0 ] | ( s [ 1 ] << 8 ) ) myList . append ( s [ 2 ] | ( s [ 3 ] << 8 ) ) if register_order == RegisterOrder . highLow : myList [ 0 ] = s [ 2 ] | ( s [ 3 ] << 8 ) myList [ 1 ] = s [ 0 ] | ( s [ 1 ] << 8 ) return myList
Convert 32 Bit real Value to two 16 Bit Value to send as Modbus Registers
floatValue: Value to be converted
return: 16 Bit Register values int[]
Convert 32 Bit real Value to two 16 Bit Value to send as Modbus Registers floatValue : Value to be converted return : 16 Bit Register values int []
"""
    Convert 32 Bit real Value to two 16 Bit Value to send as Modbus Registers
    floatValue: Value to be converted
    return: 16 Bit Register values int[]
    """ # little endian # Append Least Significant Word # Append Most Significant Word
floatValue
register_order