Jump to content
Fourth of July -- Digilent US offices closed ×

attila

Technical Forum Moderator
  • Posts

    6,662
  • Joined

  • Last visited

Posts posted by attila

  1. Hi @Steve_3

    In v3 one analog-out run is performed for each analog-in capture. Having FDwfAnalogOutRepeatTriggerSet-1 each analog-out run will wait for trigger (analog-out capture).
    After each analog-in reading by the software (FDwfAnalogInStatus) a new capture is started which also initiates a new analog-out run.
    This is why the analog-out repeat is set to infinite (FDwfAnalogOutRepeatSet-0).
    Adding wait to analog-out would delay the signal relative to the analog-in start, shift the signal to the right in the capture.
    To shift it left (or right), to start the analog-out before (or after) the capture left-most sample use a positive (or negative) secDelay parameter.

    image.png

  2. Hi @jaejoo14

    Contact the support for replacement.
    The relay on oscilloscope channel 1 is stuck on high range, so the reading is probably correct only with 1V/div and higher.
    Toggling the relay a few times, like changing between 500mV/div and 1V/div, should have removed temporary stuck, contact issue, oxidation.

    You could try the following to make sure all application settings are reset, but don't expect to help.
    /Applications/WaveForms.app/Contents/MacOS/WaveForms -safe-mode

    (For nicer app interface you could use Settings/ Options/ Style : Fusion)

  3. Hi @jaejoo14

    2 hours ago, attila said:

    2. The input range relay may be stuck or remain in bad position due to certain software settings.
    Try toggling Channel 1 Range between 500 mV/div and 1V/div
    Does it solve the problem ? Can you hear it clicking like it is for Channel 2 ?

    For warranty and replacement contact the support.digilent @ ni.com specifying the Date of Purchase, Seller and Purchase Order/ Web order Number. 

  4. Hi @jaejoo14

    1. Make sure the attenuation is set to 1 X
    2. The input range relay may be stuck or remain in bad position due to certain software settings.
    Try toggling Channel 1 Range between 500 mV/div and 1V/div
    Does it solve the problem ? Can you hear it clicking like it is for Channel 2 ?
    3. If you have calibrated the device (WaveForms/Settings/Device Manager/Calibrate), make sure the Scope 1 Gains are low values, or select Reset/Load Factory.

    image.pngimage.png

  5. Hi @Steve_3

    It comes to mind now, to have consistent capture phases trigger the AWG on Scope.

    dwf.FDwfAnalogOutTriggerSourceSet(hdwf, c_int(ChNum), trigsrcAnalogIn)
    dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_int(1))
    dwf.FDwfAnalogInConfigure(hdwf, c_int(1), c_int(1))

    You can also set:
    AnalogOutRepeatSet 0 infinite
    AnalogOutRepeatTriggerSet 1
    This way, new generator outputs are automatically performed by the device for each capture. There is no need to reconfigure the Scope or AWG in the loop, just read the captures:
    def trigger_and_read_ch0(rgdSamples,numSamp):
        while True:
            dwf.FDwfAnalogInStatus(hdwf, c_int(1), byref(sts))
            if sts.value == DwfStateDone.value:
                break
        dwf.FDwfAnalogInStatusData(hdwf, 0, rgdSamples, numSamp)  # get channel 1 data
        y = 0
        return y

    image.png

  6. Hi @Steve_3

    The fundamental problem is that the sampling is not synchronized.
    The Scope with decimate sampling for 1MHz stores every 100th ADC conversion, but this sampling is not synchronized with the AWG output, so consequent captures can have 100 phases. This Scope sampling start can not be synchronized with any trigger source. The only option would be using 100MHz sampling, but the AD2 is limited up to 16ki samples with the 2nd device configuration.

  7. Hi @Alessandro

    See the following:

    image.png

    from ctypes import *
    from dwfconstants import *
    import math
    import time
    import matplotlib.pyplot as plt
    import sys
    import numpy
    
    if sys.platform.startswith("win"):
        dwf = cdll.dwf
    elif sys.platform.startswith("darwin"):
        dwf = cdll.LoadLibrary("/Library/Frameworks/dwf.framework/dwf")
    else:
        dwf = cdll.LoadLibrary("libdwf.so")
    
    #declare ctype variables
    hdwf = c_int()
    
    version = create_string_buffer(16)
    dwf.FDwfGetVersion(version)
    print("DWF Version: "+str(version.value))
    
    dwf.FDwfParamSet(DwfParamOnClose, c_int(0)) # 0 = run, 1 = stop, 2 = shutdown
    
    #open device
    print("Opening first device")
    dwf.FDwfDeviceOpen(c_int(-1), byref(hdwf))
    
    if hdwf.value == hdwfNone.value:
        szerr = create_string_buffer(512)
        dwf.FDwfGetLastErrorMsg(szerr)
        print(szerr.value)
        print("failed to open device")
        quit()
    
    dwf.FDwfDeviceAutoConfigureSet(hdwf, c_int(0)) # 0 = the device will only be configured when FDwf###Configure is called
    
    
    sts = c_byte()
    sampling_frequency = 10000 #500000
    hzAcq = c_double(sampling_frequency)
    nSamples = 300
    rgdSamples1 = (c_double * nSamples)()
    rgdSamples2 = (c_double * nSamples)()
    rgwDigital = (c_uint16 * nSamples)()
    cAvailable = c_int()
    cLost = c_int()
    cCorrupted = c_int()
    fLost = 0
    fCorrupted = 0
    sampling_time = 1 / sampling_frequency
    
    
    ############ set up acquisition ################
    dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(0),c_int(1))  # the acquired channel is the scope 1+,1-
    dwf.FDwfAnalogInFrequencySet(hdwf, hzAcq)
    dwf.FDwfAnalogInBufferSizeSet(hdwf, c_int(nSamples)) 
    dwf.FDwfAnalogInTriggerPositionSet(hdwf, c_double(0.5*nSamples/hzAcq.value)) 
    
    
    ############ set up trigger ######################
    dwf.FDwfAnalogInTriggerSourceSet(hdwf, trigsrcExternal1)  # trigsrcDetectorAnalogIn
    
    ################# ACQUISITION #########################
        
    sts = c_byte(0)
    rgdSamples1 = (c_double * nSamples)(0)
    rgdSamples2 = (c_double * nSamples)(0)
    rgwDigital = (c_uint16 * nSamples)(0)
    print("Starting oscilloscope")
    # dwf.FDwfAnalogInConfigure(hdwf, c_int(0), c_int(1))
    dwf.FDwfAnalogInConfigure(hdwf, c_int(True), c_int(True))
    
    iSample = 0
    
    while True:
        if dwf.FDwfAnalogInStatus(hdwf, c_int(1), byref(sts)) != 1:
            szerr = create_string_buffer(512)
            dwf.FDwfGetLastErrorMsg(szerr)
            print("Error:")
            print(szerr.value)
            quit()
        if sts.value == DwfStateDone.value :
            break
        time.sleep(0.1)
    
    dwf.FDwfAnalogInStatusData(hdwf, 0, rgdSamples1, nSamples) # get channel 1 data
    dwf.FDwfAnalogInStatusData(hdwf, 1, rgdSamples2, nSamples) # get channel 2 data
    
    print("Acquisition done")
    
    if fLost:
    	print("Samples were lost! Reduce frequency")
    if fCorrupted:
    	print("Samples could be corrupted! Reduce frequency")
    rgdSamples1 = numpy.array(rgdSamples1, dtype=float)
    rgdSamples2 = numpy.array(rgdSamples2, dtype=float)
    
    plt.plot(numpy.fromiter(rgdSamples1, dtype = numpy.float))
    plt.plot(numpy.fromiter(rgdSamples2, dtype = numpy.float))
    plt.show()

     

×
×
  • Create New...