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 @Resul

    1. To improve the resolution you could use the 2nd device configuration to have 16k sample buffer compared to the 8k in the 1st, default.

    2. You may see noise around 1.5V because the reading enters in limitation. There is no additional filtering in the application.
    In the SDK the offset for both channels is set to the offset level, in the application by default only channel 1 set to offset.

    2.a Try changing the amplitude.
    2.b Try setting the channel 2 offset to 0V or configure the Wavegen and Scope C1 offset manually:

    ...
    FDwfAnalogImpedanceConfigure(hdwf, 1) // general configuration
    FDwfAnalogInChannelOffsetSet(hdwf, 1, 0.0) // Scope C2 offset
    for:
       FDwfAnalogOutNodeOffsetSet(hdwf, 0, 0, vOff) // change Wavegen offset
       FDwfAnalogOutConfigure(hdwf, 0, 1) // start wavegen
       FDwfAnalogInChannelOffsetSet(hdwf, 0, vOff) // Scope C1 offset
       FDwfAnalogInConfigure(hdwf, 0, 1) // start Scope
       while:
          FDwfAnalogImpedanceStatus(...
       FDwfAnalogImpedanceStatusMeasure(...

    3. The AD2 Wavegen can output -5V to +5V
    You could eventually use the negative supply to have a -5V reference and do 1 to +9V sweep range, then use the positive supply to have +5V reference and do -1 to -9V, or -4V for 0 to +8V and +4V for 0 to -8V.  Such 8V range of offset because you need about 1V for the signal.

    Edit: correcting wavegen offset function and scope offset sign

  2. Hi @GroupPower

    The device can perform simple average filter but advanced filtering is available in the application.

    You could capture large amount of data with Recording mode:
    - AD2 up to about 1-2MHz limited by USB bandwidth
    - ADP3450 up to 128M @ 125MHz on 1 channel or 32M @ 31.25MHz on 4 channels.

    image.thumb.png.4dac1d7fdd8eb1312f609515cb3fc507.png

  3. Hi @Resul

    There is no API for the CC/CV mode. These can be implemented in custom app similar to the example scripts in the WF app/ Imedance/ Mode: Custom, Custom Amplitude

    See the dwf.h for Vrms...
    The cs and vb will be updated in next version.

        public const int DwfAnalogImpedanceVrms = 14; // Vrms
        public const int DwfAnalogImpedanceVreal = 15; // V real
        public const int DwfAnalogImpedanceVimag = 16; // V imag
        public const int DwfAnalogImpedanceIrms = 17; // Irms
        public const int DwfAnalogImpedanceIreal = 18; // I real
        public const int DwfAnalogImpedanceIimag = 19; // I imag

     

  4. Hi @JEK

    1. The most accurate measurement would be by connecting EFG/Trig to the other AD2 Scope channel and triggering on rising edge of this.
    2. You could connect EFG/Trig to AD2 Trigger and trigger on this but in this case you won't see the trigger graphically represented, only as T0
    3. You could also connect EFG/Trig to AD2 DIO and use Scope in mixed mode by adding DIO channels and trigger on this.

  5. Hi @logicmax

    The following example starts by generating a sawtooth then switches to square signal using FDwfAnalogOutNodeDataSet.
    Generated by AD2 and captured with ADP.

    image.thumb.png.f2468c80d55dca64eb25f6e9d42b7786.png

    import sys
    import time
    from ctypes import *
    
    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")
    
    hdwf = c_int()
    channel = c_int(0) # AWG 1
    
    print("Opening first device...")
    #dwf.FDwfEnum(0,0)
    dwf.FDwfDeviceOpen(c_int(-1), byref(hdwf))
    
    if hdwf.value == 0:
        print("Failed to open device")
        szerr = create_string_buffer(512)
        dwf.FDwfGetLastErrorMsg(szerr)
        print(str(szerr.value))
        quit()
    
    dwf.FDwfDeviceAutoConfigureSet(hdwf, c_int(0)) 
    
    dwf.FDwfAnalogOutNodeEnableSet(hdwf, channel, 0, c_bool(True))
    dwf.FDwfAnalogOutNodeFunctionSet(hdwf, channel, 0, c_int(31)) #funcPlay
    dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, channel, 0, c_double(0.8))
    
    cBuffer = c_int(0)
    dwf.FDwfAnalogOutNodeDataInfo(hdwf, channel, 0, 0, byref(cBuffer))
    dwf.FDwfAnalogOutNodeFrequencySet(hdwf, channel, 0, c_double(1e3*cBuffer.value)) # 1kHz to sample rate
    rgdSamples = (c_double*cBuffer.value)()
    
    for i in range(0, cBuffer.value): # saw
        rgdSamples[i] = 2.0*i/cBuffer.value-1.0
        
    dwf.FDwfAnalogOutNodeDataSet(hdwf, channel, 0, rgdSamples, cBuffer)
    
    dwf.FDwfAnalogOutConfigure(hdwf, channel, c_bool(True)) # start
    
    print("sawtooth started")
    time.sleep(5)
    
    for i in range(0, cBuffer.value): #square
        if i<cBuffer.value/2:
            rgdSamples[i] = -1
        else:
            rgdSamples[i] = 1
    
    dwf.FDwfAnalogOutNodePlayData(hdwf, channel, 0, rgdSamples, cBuffer)
    
    print("change to square")
    time.sleep(5)
    
    print("done")
    dwf.FDwfAnalogOutReset(hdwf, channel)
    dwf.FDwfDeviceClose(hdwf)

     

  6. Hi @logicmax

    1. If you are using the Play mode the DataSet (prefill) and Configure (start) needs to be called only in the initialization. The following data chunks sent with PlayData, see AnalogOut_Play.py

    2. If you are generating a periodic signal (FGen) and want to change the signal or other parameters:
    FDwfDeviceOpen(...)
    FDwfDeviceAutoConfigureSet(hdwf, 0); // the device will be configured only when calling FDwf###Configure
    ...
    FDwfAnalogOutConfigure(hdwf, channel, 1); // start Wavegen
    loop:
       ...
       FDwfAnalogOutOffsetSet(...)
       FDwfAnalogOutNodeDataSet(...)
       FDwfAnalogOutConfigure(hdwf, channel, 3); // apply, do not change state

    image.png.be98f8edd1b6e8e05976be5af627f635.png

    3. A non-intended usage of Play mode, if you only want to change the generated periodic signal could be using the FDwfAnalogOutNodePlayData.
    With this method the full device buffer size of data should be sent and frequency set as sample rate.
    This method should be faster than 2. since only the data is sent, other configurations are not applied.

    2-3 Depending on the generator rate you may notice altering samples at the output, from the previous and new signal. This due to the concurrence between write to device buffer and reading from this to the output.

    image.thumb.png.30d5efd5e2d81abecb8e1cf225b4ff24.png

  7. Hi @Sebastian C

    Use:
    # trigger detector mask:                         low     & hight   & ( rising             |           falling )
    dwf.FDwfDigitalInTriggerSet(self.hdwf, c_int(0), c_int(0), c_int(1<<self.idxCS), c_int(1<<self.idxCS))

    The FDwfDigitalSpi# functions are for master. For spy purpose it is suffice to use the FDwfDigitalIn functions, see: WF SDK/ samples/ py/ DigitalIn_Spi_Spy.py

  8. Hi @Resul

    I think you could use the FDwfAnalogImpedanceStatusInput example: AnalogNetwork_Analyzer.py

    dwf.FDwfAnalogImpedanceStatusInput(hdwf, c_int(0), byref(gain1), 0) # relative to FDwfAnalogImpedanceAmplitudeSet Amplitude/C1
    dwf.FDwfAnalogImpedanceStatusInput(hdwf, c_int(1), byref(gain2), byref(phase2)) # relative to Channel 1, C1/C#

    For mode 0 (W1-C1-DUT-C2-R-GND) or 8 (AD IA adapter) :

    gain1 = Amp/VrmsC1
    gain2 = VrmsC1/VrmsC2

    VrmsC1 = A/gain1
    VrmsC2 = A/gain1/gain2

    Vrms = VrmsC1-VrmsC2
    Irms = VrmsC2/Res

    Edit:
    Next software version will add such measurement options for the API.

×
×
  • Create New...