Jump to content
  • 0

simultaneous acquisition python averaging


darth458

Question

Hello,

I have transcribed the macro analoginoutsync.txt into python by tracing the parser activity to SDK calls in DWFCMD. To my knowledge this capability was not in the python examples. My concern in general is that I would like to do program-directed signal averaging since that is not built into the API. Should I be worried about jitter in the delay between starting the analog input channel and putting out a PC trigger pulse to start the analog output? Is there a reason why this ordinary and useful capability was only represented in one macro example and not in cpp or python examples?

Also can I ask for a builtin capability to output a user waveform and take data  with a time offset while synchronously signal averaging? In other words, an impulse response which is synchronized to the system clock for averaging that is stationary? 

 

thanks

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

Hi @darth458

The Scope sample averaging anyway hides the higher frequency components and attenuates a bit the signal.
Due to this, there is no reason and there is no option to synchronize the averaging.

The WF beta version lets you use external sampling clock, an external trigger IO line. https://forum.digilentinc.com/topic/8908-waveforms-beta-download/
The ADC is still running on internal 100MHz clock, but the stored conversion is based on external signal edge (+delay). With this option averaging is not supported.
image.png.fa1738f84868108606a0f0adbb83b42d.png

 

 

Link to comment
Share on other sites

Hello Attila, I'm not using the GUI. In the example I mention (analoginoutsync.txt) the method is to set the output to trigger off of PC, start the input, and in the next line of code in the cpp subroutine ...StartAll...  it calls the PC trigger. So the time relationship there is vulnerable to the host program timing unless there is a command fifo.

Superficially, I would think that if you set both output and input to trigger off the PC, then when you invoke the PC trigger you could reasonably expect that the two channels would have a constant time relationship if you set the ADC sample rate to 100MHz. But I don't see that in the examples code. I don't expect uniform timing of acquisitions from using PC trigger but I do need the out vs in timing to stay the same in clock cycles if I trigger them with srcPC. Is that true?

thanks :)

Link to comment
Share on other sites

Hi @darth458

The Scope and AWG, analog-in and out are controller by the same device (same oscillator-clock) so the inputs and outputs will be jitter free.
The Scope can be triggered by AWG like this:

#...
dwf.FDwfAnalogInTriggerSourceSet(hdwf, trigsrcAnalogOut1)  # =7, trigger Scope on AWG 1 start
dwf.FDwfAnalogInConfigure(hdwf, c_bool(False), c_bool(True)) # start Scope
dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_bool(True)) # start AWG 1
#...

 

Link to comment
Share on other sites

Hello Attila,

I tried to do this with a repeating custom waveform but it doesn't work. A repeating waveform comes out but it doesn't trigger the input?


dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_bool(True))                           
dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(0), AnalogOutNodeCarrier, funcCustom) 
dwf.FDwfAnalogOutNodeDataSet(hdwf, c_int(0), AnalogOutNodeCarrier, rgdSamples, c_int(1000))
dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(100000.0))
dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(0.5))

dwf.FDwfAnalogOutRepeatSet(hdwf, c_int(0), c_int(0))                                           # repeat forever

dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(0), c_bool(True))

dwf.FDwfAnalogInFrequencySet(hdwf, c_double(100000000))
dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(0), c_double(4))
dwf.FDwfAnalogInBufferSizeSet(hdwf, c_int(1000))

dwf.FDwfAnalogInTriggerAutoTimeoutSet(hdwf, c_double(0))                                 #disable auto trigger
dwf.FDwfAnalogInTriggerSourceSet(hdwf, trigsrcAnalogOut1)                                #source analog 1
dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_bool(True)
dwf.FDwfAnalogInConfigure(hdwf, c_int(0), c_bool(True)

BELOW, loop on anaalog in done to take data

 

Link to comment
Share on other sites

Hi @darth458

The analog-out trigger output is high while running, so you have to specify finite run and wait time in order to generate trigger edges, like:
dwf.FDwfAnalogOutRunSet(hdwf, channel, c_double(0.01)) # run for 10ms
dwf.FDwfAnalogOutWaitSet(hdwf, channel, c_double(2e-8)) # wait 20ns or more
dwf.FDwfAnalogOutRepeatSet(hdwf, channel, c_int(0)) # repeat forever


To capture with analog-in the first analog-out run, configure the analog-in before the analog-out, like:
dwf.FDwfAnalogInConfigure(hdwf, c_int(0), c_bool(True))
dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_bool(True))
 

Link to comment
Share on other sites

Hi Attila,

I have a later post in which I tried to use the pattern generator to create a trigger for both channels by jumpering DIO pin 0 to T1. That is where my interest lies now. That didn't work either although the pattern generator was putting out a signal and connected to T1.

 

thanks,

Steve

Link to comment
Share on other sites

Hi @darth458

I don't see why the code in your other post would not work...
You can try applying the earlier suggested changes for internal analog out to in triggering, since this should solve an issue.
If it is still not working, please post the loop code with state checking, but it would be even better to have your whole code to be able to test it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...