def rawAsynch(self, Data, AddDelay = False, TimeoutActive = False, SetTransmitEnable = False, PortB = False, NumberOfBytesToWrite = 0, NumberOfBytesToRead = 0):
        """
        Name: U12.rawAsynch(Data, AddDelay = False, TimeoutActive = False,
                            SetTransmitEnable = False, PortB = False,
                            NumberOfBytesToWrite = 0, NumberOfBytesToRead = 0)
                            
        Args: Data, A list of bytes to write.
              AddDelay, True to add a 1 bit delay between each transmit byte.
              TimeoutActive, True to enable timeout for the receive phase.
              SetTransmitEnable, True to set Transmit Enable to high during
                                 transmit and low during receive.
              PortB, True to use PortB instead of PortA.
              NumberOfBytesToWrite, Number of bytes to write.
              NumberOfBytesToRead, Number of bytes to read.
        
        Desc: Requires firmware V1.1 or higher. This function writes and then
              reads half-duplex asynchronous data on 1 of two pairs of D lines.
              See section 5.13 of the User's Guide.
              
        Returns: A dictionary with the following keys,
            DataByte0-3, the first four data bytes read over the RX line
            ErrorFlags, a BitField representing the error flags.
        
        Example:
        >>> import u12
        >>> d = u12.U12()
        >>> # Set the full and half A,B,C to 9600
        >>> d.rawWriteRAM([0, 1, 1, 200], 0x073)
        >>> d.rawWriteRAM([5, 1, 2, 48], 0x076)
        >>> print d.rawAsynch([1, 2, 3, 4], NumberOfBytesToWrite = 4, NumberOfBytesToRead = 4)
        {
         'DataByte3': 4,
         'DataByte2': 3,
         'DataByte1': 2,
         'DataByte0': 1,
         'ErrorFlags': <BitField object: [ Timeout Error Flag = 0 (0), ... ] >
        }
        
        """
        command = [ 0 ] * 8
        
        if not isinstance(Data, list) or len(Data) > 4:
            raise U12Exception("Data wasn't a list, or was too long.")
        
        NumberOfBytesToWrite = NumberOfBytesToRead & 0xff
        NumberOfBytesToRead = NumberOfBytesToRead & 0xff
        if NumberOfBytesToWrite > 18:
            raise U12Exception("Can only write 18 or fewer bytes at a time.")
        if NumberOfBytesToRead > 18:
            raise U12Exception("Can only read 18 or fewer bytes at a time.")
        
        Data.reverse()
        
        command[:len(Data)] = Data
        
        bf = BitField()
        bf.bit3 = int(bool(AddDelay))
        bf.bit2 = int(bool(TimeoutActive))
        bf.bit1 = int(bool(SetTransmitEnable))
        bf.bit0 = int(bool(PortB))
        
        command[4] = int(bf)
        
        #01100001 (Asynch)
        bf2 = BitField()
        bf2.bit6 = 1
        bf2.bit5 = 1
        bf2.bit0 = 1
        
        command[5] = int(bf2)
        command[6] = NumberOfBytesToWrite
        command[7] = NumberOfBytesToRead
        
        self.write(command)
        results = self.read()
        
        if command[5] != results[5]:
            raise U12Exception("Expected Asynch response, got %s instead." % results[5])
        
        returnDict = dict()
        returnDict['DataByte3'] = results[0]
        returnDict['DataByte2'] = results[1]
        returnDict['DataByte1'] = results[2]
        returnDict['DataByte0'] = results[3]
        
        bfLabels = ["Timeout Error Flag", "STRT Error Flag", "FRM Error Flag", "RXTris Error Flag", "TETris Error Flag", "TXTris Error Flag"]
        bf = BitField( rawByte = results[4], labelPrefix = "", labelList = bfLabels )
        
        returnDict["ErrorFlags"] = bf
        
        return returnDict
dataset/ETHPy150Open LabPy/lantz/lantz/drivers/labjack/_internal/u12.py/U12.rawAsynch/original