• 0

Multi-Channel AnalogIn



I am sending synchronized, phase-shifted pulses with the AWG on both AnalogOut channels on the Discovery2, using a custom application I'm writing in python.  I am feeding the AnalogOut directly back to the AnalogIn with no additional hardware involved. I am trying to read the two AWG signals using the AnalogIn channels, but I can't get Channel 2 to report the signal. Instead, both signals are adding together and displaying as coming from channel 1, with the expected channel 2 signal showing up as negative voltages on channel 1.  How do I separate the two signals? 


This is the chunk of code I am using to record samples and plot (mostly copied from the provided code samples):

 #configure analog in 
            self.dwf.FDwfAnalogInFrequencySet(hdwf, c_double(int(hzSys.value/(100*self.xRate))))
            self.dwf.FDwfAnalogInBufferSizeSet(hdwf, c_int(4000)) 
            self.dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(0), c_bool(True))
            self.dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(0), c_double(5)) 
            self.dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(1), c_bool(True))
            self.dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(1), c_double(5))              
            #begin acquisition
            self.dwf.FDwfAnalogInConfigure(hdwf, c_int(1), c_int(1))
            #collect data
            sts = c_int()
            while True:
                self.dwf.FDwfAnalogInStatus(hdwf, c_int(1), byref(sts))
                if sts.value == DwfStateDone.value :
            #read data            
            rg1 = (c_double*1000)()   #rg = pointer to allocated buffer to copy the acquisition data
            rg2 = (c_double*1000)()   #rg = pointer to allocated buffer to copy the acquisition data
            self.dwf.FDwfAnalogInStatusData(hdwf, c_int(0), rg1, len(rg1)) # get channel 1 data
            self.dwf.FDwfAnalogInStatusData(hdwf, c_int(1), rg2, len(rg2)) # get channel 2 data
            #set up plot
            plt1 = self.canvasX.figure.add_subplot(211)
            plt2 = self.canvasX.figure.add_subplot(212)
            #plot data
            for i in range(0,len(rgpy1)):
            plt1.plot(rgpy1, 'b')
            plt2.plot(rgpy2, 'r')



Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hi @spri

It looks like you have connected the AWG1 to Scope 1 positive input and AWG2 to Scope 1 negative input. That's why you are seeing the addition of the two signals.

The Scope 2 positive input is the blue wire and connect the negative inputs to ground (orange/white and blue/white).

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now