mabernico

Members
  • Content Count

    3
  • Joined

  • Last visited

  1. Thank you! That was very helpful. I now need to work on toggling the DI0 and DI1 lines when certain frequencies are reached. Will it be possible to toggle DI0 for example when 700Hz is reached using this method. Also this method seems to introduce some high-frequency noise for the first few ms. I can probably filter this out, but it is triggering my input device (not the Analog Discovery) prematurely. I really appreciate your time looking into this and what you have provided thus far. Just bought 2 more DADs to do some more work!
  2. I am trying to utilize the Analog discovery (via Python) to generate a square wave that will sweep up from 1 to 1590Hz over 30 seconds, then hold for 10 seconds at 1590, and then sweep down to 1 again. I have been able to mangle some code together to make this happen, but it seems that the implementation I am using is allowing the DAD unit to turn off and turn back on to generate these piecewise. The problem with that is (understandably) there is a ~3ms gap between signals when the unit is done with one segment and moves to the next. I assume it has more to do with using sleep commands and using dwf.FDwfAnalogOutConfigure() to start the next segment. Is there something I should be using instead of sleep that may allow a continuous signal? RPM = c_int(0) hzStart = float(1) hzStop = float(1590) secSweep = float(10) holdTime=int(5) #Calculations for sweep up setup HzDiff=float(hzStop-hzStart) HzSum=float(hzStart+hzStop) halfHzSum=float(HzSum/2) fmAmp=float(100.0*(HzDiff)/(HzSum)) fmOs=float(1/secSweep) #Calculations for sweep down setup HzDiff2=float(hzStart-hzStop) HzSum2=float(hzStart+hzStop) halfHzSum2=float(HzSum2/2) fmAmp2=float(100.0*(HzDiff2)/(HzSum2)) fmOs2=float(1/secSweep) #Digital Output Setup # set output enable, mask on 2 LSB IOs, DIO 1 and 0 dwf.FDwfDigitalIOOutputEnableSet(hdwf, c_int(0x0003)) # set output value, D1: 3.3V, D0: 0V dwf.FDwfDigitalIOOutputSet(hdwf, c_int(0x0002)) print "Generating square wave..." dwf.FDwfAnalogOutNodeEnableSet(hdwf, RPM, AnalogOutNodeCarrier, c_bool(True)) dwf.FDwfAnalogOutNodeFunctionSet(hdwf, RPM, AnalogOutNodeCarrier, funcSquare) dwf.FDwfAnalogOutNodeFrequencySet(hdwf, RPM, AnalogOutNodeCarrier, c_double(halfHzSum)) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, RPM, AnalogOutNodeCarrier, c_double(1.65)) dwf.FDwfAnalogOutNodeOffsetSet(hdwf, RPM, AnalogOutNodeCarrier, c_double(1.65)) dwf.FDwfAnalogOutNodeEnableSet(hdwf, RPM, AnalogOutNodeFM, c_bool(True)) dwf.FDwfAnalogOutNodeFunctionSet(hdwf, RPM, AnalogOutNodeFM, funcRampUp) dwf.FDwfAnalogOutNodeSymmetrySet(hdwf, RPM, AnalogOutNodeFM, c_double(100)) dwf.FDwfAnalogOutNodeFrequencySet(hdwf, RPM, AnalogOutNodeFM, c_double(fmOs)) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, RPM, AnalogOutNodeFM, c_double(fmAmp)) #turn on RPM signal and run entire ramp up dwf.FDwfAnalogOutConfigure(hdwf, RPM, c_bool(True)) time.sleep(secSweep) #wait until rampup is done #switch RPM signal to hold at max frequency dwf.FDwfAnalogOutNodeFrequencySet(hdwf, RPM, AnalogOutNodeCarrier, c_double(795)) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, RPM, AnalogOutNodeFM, c_double(1.65)) dwf.FDwfAnalogOutNodeFunctionSet(hdwf, RPM, AnalogOutNodeFM, funcSquare) dwf.FDwfAnalogOutConfigure(hdwf, RPM, c_bool(True)) time.sleep(holdTime) #wait until hold is done dwf.FDwfAnalogOutNodeFrequencySet(hdwf, RPM, AnalogOutNodeCarrier, c_double(halfHzSum2)) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, RPM, AnalogOutNodeCarrier, c_double(1.65)) dwf.FDwfAnalogOutNodeFrequencySet(hdwf, RPM, AnalogOutNodeFM, c_double(fmOs2)) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, RPM, AnalogOutNodeFM, c_double(fmAmp2)) dwf.FDwfAnalogOutConfigure(hdwf, RPM, c_bool(True)) time.sleep(secSweep) #wait until rampdown is done print "done." dwf.FDwfDeviceClose(hdwf)
  3. I would like to use the Analog Discovery via the MATLAB DAQ interface. I would like to output a custom signal to both AWG1 and AWG2 simultaneously. I am able to produce a signal on a single channel using the following code (where output1 is an array of 0s or 3.3s to produce a square wave). When I monitor this at the headphone jack I receive a frequency sweep in my right ear. s=daq.createSession('digilent') ; ch=s.addAnalogOutputChannel('AD1',1,'Voltage'); s.Rate=100e3; s.queueOutputData(output1.'); s.startForeground; If i change the second line to this: ch=s.addAnalogOutputChannel('AD1',2,'Voltage'); I am able to get a signal from AWG2. When I monitor this at the headphone jack I receive a frequency sweep in my left ear, as expected. I would like to get output from both AWGs simultaneously. In the code below the attempt is to duplicate the same signal on both AWGs. When I monitor this at the headphone jack I get a single frequency square wave in only the right ear. s=daq.createSession('digilent') ; ch=s.addAnalogOutputChannel('AD1',1:2,'Voltage'); s.Rate=100e3; s.queueOutputData([output1.' output1.']); s.startForeground; The entire length of the playback is 90 seconds. I have tried reducing the number of data points and the sample rate by a factor of 2 thinking it was a buffering issue. I would expect that cutting it in half would work since I am using the same data two times over, but even cutting it by a factor of 10 yielded no different results. Can you provide any suggestion as to what I might do to get the desired output?