Search the Community

Showing results for tags 'trigger'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News
    • New Users Introduction
    • Announcements
  • Digilent Technical Forums
    • FPGA
    • Test and Measurement
    • Measurement Computing (MCC)
    • Add-on Boards
    • Digilent Microcontroller Boards
    • Non-Digilent Microcontrollers
    • LabVIEW
    • FRC
    • Other
  • General Discussion
    • Project Vault
    • Learn
    • Suggestions & Feedback
    • Buy, Sell, Trade
    • Sales Questions
    • Off Topic
    • Educators
    • Technical Based Off-Topic Discussions
    • Archived

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 11 results

  1. Hello there, I need to log the 2 analog Channels simultaniously with a high Samplerate of ~6MS, everything triggered off the falling edge of DIO pin 6. (IQ channels of FMCW radar, triggered of the PLLs Chirp Start signal) I already managed to log Data on one channel using the 16k Buffer. Also Triggering on the second Channel as well as on the external Trigger worked. But I can not manage to trigger of an specific DIO pin. Everything in Python. 1. If I got the SDK right, I only need one hdwf device handle for the AD2, not one for the analog and one for the digital instrument? 2. Also with the Trigger Bus I should be able to trigger the Analog Instrument off the DigitalTriggerDetector? 3. So my understandig is that I set the AnalogIn Trigger Source to DetectorDigitalIn (Trigger Bus connection). All the settings for the Trigger itself condition/pin/PositionShift/... have then to be done under: FDwfDigitalInTrigger...() in the DigitalDtriggerDetectior, right? 4. If so I can not really see from the SDK and the Examples, what Fuctions I have to call to arm the DigitalTriggerDetector in Order to Trigger on the Falling Edge of DIO6. Please tell me the necessary functionsto do so!:) 5. And one more additional question: Does every Analog Channel have its own 16k buffer or is the buffer shared for both or even the Digial pins as well? And is there a more in depth documentation then the SDK and examples? Thanks in advance! I added the code below: from ctypes import * from dwfconstants import * import math import time import matplotlib.pyplot as plt import sys import numpy ####### Load the DWF, which forms the API between Python ond the C based Waveforms SDK ####### 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") ######################################################################################### ########################## user definable parameters #################################### ######################################################################################### AcqHz = 100e6 # acquisitionHz / samplerate of ADC, max. 100MHz Samples = 2**14 # samples to collect after triggering, max. 2^14 samples ChlRange = 3.3 # set the +- Voltage range of AnalogIN Channel TrgPin = 6 # set the DIO Pin for the Trigger TrgLvl = 1.1 # set the voltage for the Trigger ######################################################################################### ######################################################################################### hdwf = c_int() # create datatype for hardware handle of AD2 sts = c_byte() # create datatype for later status request of acquisition nSamples = (c_double * Samples)() # create array for samples to be stored in ####### get the DWF Version provided by Digilent as an API between Python and the C based Waveforms SDK ####### version = create_string_buffer(16) dwf.FDwfGetVersion(version) print("Digilent DWF (API) Version: " + str(version.value)) ####### opening the device ####### print("Opening first device") #dwf.FDwfDeviceOpen(c_int(-1), byref(hdwf)) # 2nd configuration for Analog Discovery with 16k analog-in buffer dwf.FDwfDeviceConfigOpen(c_int(-1), c_int(1), byref(hdwf)) # open the AD2 and retrieve the handle if hdwf.value == hdwfNone.value: # if no device is found or the device is already in use szError = create_string_buffer(512) dwf.FDwfGetLastErrorMsg(szError); print("failed to open device\n" + str(szError.value)) quit() ####### set up acquisition ####### dwf.FDwfAnalogInFrequencySet(hdwf, c_double(AcqHz)) # set acquisition frequency dwf.FDwfAnalogInBufferSizeSet(hdwf, c_int(len(nSamples))) # set the buffer size for AnalogIn dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(0), c_bool(True)) dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(0), c_double(ChlRange)) # set the Voltage range of AnalogIN Channel ####### set up trigger for the analog channel to be the DigitalInDetector ####### dwf.FDwfAnalogInTriggerAutoTimeoutSet(hdwf, c_double(0)) # disable auto trigger at analog channel dwf.FDwfAnalogInTriggerSourceSet(hdwf, trigsrcDetectorDigitalIn) # set the triggger source for the analog channels to be the DigitalInTriggerDetector #dwf.FDwfAnalogInTriggerSourceSet(hdwf, trigsrcExternal1) # ExtTrg1 as Trigger Source ### settings for analogIn Trigger Detector ### ''' dwf.FDwfAnalogInTriggerTypeSet(hdwf, trigtypeEdge) dwf.FDwfAnalogInTriggerConditionSet(hdwf, trigcondFallingNegative) # <----------------- warum geht das nicht?? dwf.FDwfAnalogInTriggerChannelSet(hdwf, c_int(0)) # first channel dwf.FDwfAnalogInTriggerLevelSet(hdwf, c_double(TrgLvl)) # trigger level 0.5V dwf.FDwfAnalogInTriggerConditionSet(hdwf, trigcondRisingPositive) # move trigger to left boundary, otherwise the signal will start in the middle #dwf.FDwfAnalogInTriggerPositionSet(hdwf, c_double(Samples/(2*AcqHz)))# Configures the horizontal trigger position in seconds. #dwf.FDwfAnalogInTriggerPositionSet(hdwf, c_double(4000/(2*AcqHz)))# Configures the horizontal trigger position in seconds. print("Trigger horizontal Position Set to: " +str(-Samples/(2*AcqHz)) + "sec. Left boundary of Buffer.") ''' ####### settings for the trigger on digital channel ####### #dwf.FDwfDigitalInTriggerSourceSet(hdwf, c_ubyte(3)) # trigsrcDetectorDigitalIn - Sets the trigger source for the instrument. #dwf.FDwfDigitalInTriggerPositionSet(hdwf, c_int(int(cSamples/2-1))) # Sets the number of samples to acquire after trigger. ## Configures the digital in trigger detector. ## #The logic for the trigger bits is: Low and High and (Rise or Fall). Setting a bit in both rise and fall will trigger on any #edge, any transition. For instance FDwfDigitalInTriggerInfo(hdwf, 0b0001, 2, 4, 8) will generate trigger when DIO-0 is low #and DIO-1 is high and DIO-2 is rising or DIO-3 is falling. The bits of the arguments represent pins. # FDwfDigitalInTriggerSet(HDWF hdwf, uint fsLevelLow, uint fsLevelHigh, uint fsEdgeRise, uint fsEdgeFall) dwf.FDwfDigitalInTriggerSet(hdwf, c_int(0), c_int(0), c_int(0), c_int(1<<6)) # DIO6 falling edge - The bits of the arguments represent pins. ####### set up power supply ####### dwf.FDwfAnalogIOChannelNodeSet(hdwf, c_int(0), c_int(0), c_double(True)) # enable positive supply dwf.FDwfAnalogIOChannelNodeSet(hdwf, c_int(0), c_int(1), c_double(3.3)) # set voltage to ... V dwf.FDwfAnalogIOChannelNodeSet(hdwf, c_int(1), c_int(0), c_double(True)) # enable negative supply dwf.FDwfAnalogIOChannelNodeSet(hdwf, c_int(1), c_int(1), c_double(-3.3)) # set voltage to -... V dwf.FDwfAnalogIOEnableSet(hdwf, c_int(True)) # master enable ###### wait at least 2 seconds with Analog Discovery for the offset to stabilize, before the first reading after device open or offset/range change ##### time.sleep(2) ####### get AnalogIN instrument in Ready state ####### print("Starting AnalogIN instrument. Waiting for trigger...") # FDwfAnalogInConfigure(hdwf, int fReconfigure, int fStart) dwf.FDwfAnalogInConfigure(hdwf, c_bool(False), c_bool(True)) # Configures the instrument and start or stop the acquisition. To reset the Auto trigger timeout, setfReconfigure to TRUE. ####### repeatedly check if acquisition has been made ####### while True: dwf.FDwfAnalogInStatus(hdwf, c_int(1), byref(sts)) if sts.value == DwfStateDone.value: # if so: acquisition completed, break while loop break time.sleep(0.001) # else: wait 1ms and check again ####### get the nSamples from the desired channel ####### dwf.FDwfAnalogInStatusData(hdwf, 0, nSamples, len(nSamples)) # get channel 1 data from buffer # dwf.FDwfAnalogInStatusData(hdwf, 1, nSamples, len(nSamples)) # get channel 2 data print("Data collected from AnalogIN buffer.") ####### close device and free handle ####### dwf.FDwfDeviceCloseAll() print("Device released.") ####### store data to .csv file ####### f = open("TriggeredRecord.csv", "w+") for value in nSamples: f.write("%s\n" % value) f.close() print("Data saved to .csv file.") ####### display data ####### plt.plot(numpy.fromiter(nSamples, dtype=numpy.double), 'bo-') # plot(x,y,style) plt.show()
  2. Hi, I'm using the Waveform SDK with Python and I'm not able to get the DD to start the pattern output with a digital input as trigger. I have tried to look into the different examples in the SDK, but none of them seem to fit this exact use case. Use case: Preparation: Generate a pattern Run time: Get a rising edge on a specified I/O pin (e.g. DIO-25) Wait an amount of time using FDwfDigitalOutWaitSet Play pattern on a specified I/O pin (e.g. DIO-24) Do you have a code snippet which fits this use case? Best, Hakon.
  3. Hello Forum :-) I will first wish all a happy new year :-) One question is it possible to set really complex-trigger-scenarios in waveform at osciloscope? E.g. trigger fire when: Ch1 <= 20 and Ch2 == 10 E.g. trigger fire when: RisingEdge(Ch1, 20) OR FallingEdge(Ch2, 2) E.g. trigger fire when: (Ch1 + 3) == 8 E.g. trigger fire when: (Ch1 + 3) == SQRT(Ch2) E.g. trigger fire when: (Ch1 + Ch2) == (Ch3+ 10) E.g. trigger fire when: (Ch1 / Ch2) <= (Ch3 + Abs(Ch4)) ...such things (in any compexity, combinations and deepnees) I work in my company at HIL-Testing ( https://en.wikipedia.org/wiki/Hardware-in-the-loop_simulation ) For complex trigger-definitions use dSPACE-Tools ( https://www.dspace.com/en/inc/home.cfm ) and I itself in my own software-implementations the GE-Syntax which is really good for definition of flexible and complex trigger-definitions https://www.asam.net/active-projects/resources/ (view there: ASAM Expression v1.0.1 ) REMARK: This is perhaps an similar question (and wish) like here: Best regards Alfons
  4. Hi, I am using Raspberry Pi 4 and Analog discovery 2 to building a sampling system. The trigger signal is generated by the raspberry pi and routed to the second analog input channel. The trigger signal has a voltage of 4 V and the trigger mode is set as Positive edge. From the lab oscilloscope, the trigger signal is observed while it is not read out by the analogIn channel of the Analog discovery 2 oscilloscope (it shows that the system stopped at Reading analog in status) . I am wondering whether there is anything wrong with my codes (shown as attached codes, especially in the trigger setting part), hope to have your advice. Best regards, Zeyu from time import sleep import RPi.GPIO as GPIO import signal from ctypes import * from dwfconstants import * import math import time import matplotlib.pyplot as plt import sys import numpy from csv import writer import pandas as pd 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() sts = c_byte() hzAcq = c_double(1e8) nSamples = int(1e4) cAvailable = c_int() cLost = c_int() cCorrupted = c_int() fLost = 0 fCorrupted = 0 #print(DWF version version = create_string_buffer(16) dwf.FDwfGetVersion(version) print("DWF Version: "+str(version.value)) #open device for j in range(1, 3, 1): print("Opening first device") dwf.FDwfDeviceOpen(c_int(-1), byref(hdwf)) rgSamples1 = (c_int16*nSamples)() if hdwf.value == hdwfNone.value: szerr = create_string_buffer(512) dwf.FDwfGetLastErrorMsg(szerr) print(str(szerr.value)) print("failed to open device") quit() print("Generating sine wave...") dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_bool(True)) dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(0), AnalogOutNodeCarrier, funcSine) dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double((90.0+j)*hzAcq.value/nSamples)) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_double(5)) dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_bool(True)) #set up acquisition dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(0), c_bool(True)) dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(0), c_double(5)) dwf.FDwfAnalogInAcquisitionModeSet(hdwf, acqmodeRecord) dwf.FDwfAnalogInFrequencySet(hdwf, hzAcq) dwf.FDwfAnalogInRecordLengthSet(hdwf, c_double(nSamples/hzAcq.value)) # -1 infinite record length def lopper(): for i in range(1,300): GPIO.output(7,0) sleep(0.001) GPIO.output(8,1) sleep(0.001) GPIO.output(8,0) GPIO.output(7,1) sleep(0.001) GPIO.output(7,0) GPIO.setmode(GPIO.BCM) GPIO.setup(7,GPIO.OUT) GPIO.setup(8,GPIO.OUT) lopper() dwf.FDwfAnalogInTriggerAutoTimeoutSet(hdwf, c_double(0)) #disable auto trigger dwf.FDwfAnalogInTriggerSourceSet(hdwf, trigsrcDetectorAnalogIn) #one of the analog in channels dwf.FDwfAnalogInTriggerTypeSet(hdwf, trigtypeEdge) dwf.FDwfAnalogInTriggerChannelSet(hdwf, 1) # first channel dwf.FDwfAnalogInTriggerLevelSet(hdwf, c_double(3.5)) # 0.5V dwf.FDwfAnalogInTriggerConditionSet(hdwf, trigcondRisingPositive) # dwf.FDwfAnalogInTriggerHoldOffSet(hdwf, c_double(0.01)) GPIO.cleanup() print("Starting dwf.FDwfAnalogInConfigure(hdwf, c_bool(False), c_bool(True)) dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_bool(True)) dwf.FDwfAnalogOutReset(hdwf, c_int(0)) iSample = 0 while True: dwf.FDwfAnalogInStatus(hdwf, c_int(0), byref(sts)) dwf.FDwfAnalogInStatusRecord(hdwf, byref(cAvailable), byref(cLost), byref(cCorrupted)) iSample += cLost.value iSample %= nSamples if cLost.value : fLost = 1 if cCorrupted.value : fCorrupted = 1 iBuffer = 0 #wait at least 2 sec while cAvailable.value>0: cSamples = cAvailable.value # we are using circular sample buffer, make sure to not overflow if iSample+cAvailable.value > nSamples: cSamples = nSamples-iSample dwf.FDwfAnalogInStatusData16(hdwf, c_int(0), byref(rgSamples1, sizeof(c_int16)*iSample), c_int(iBuffer), c_int(cSamples)) # get channel 1 dat iBuffer += cSamples cAvailable.value -= cSamples iSample += cSamples iSample %= nSamples if sts.value == DwfStateDone.value : # done break dwf.FDwfDeviceCloseAll() if iSample != 0 : rgSamples1 = rgSamples1[iSample:]+rgSamples1[:iSample] print("Recording done "+str(iSample)) if fLost: print("Samples were lost! Reduce frequency") if fCorrupted: print("Samples could be corrupted! Reduce frequency") List = [] for v in rgSamples1: List.append(v) with open("record5.csv", "a") as f_object: writer_object = writer(f_object) writer_object.writerow(List) f_object.close() plt.plot(numpy.fromiter(rgSamples1, dtype = numpy.int16)) plt.show() file=open("record6.csv","w") df=pd.read_csv("record5.csv",header=None, low_memory=False) data=df.values data=list(map(list,zip(*data))) data=pd.DataFrame(data) data.to_csv(file,header=0,index=0) text = open("record6.csv", "r") text = ' '.join([i for i in text]) text = text.replace(",", " ") file = open('read.txt', 'w') file.write(text) file.close()
  5. Hello. I'm trying to analyze an analog signal using the WaveForm SDK on Linux (Ubuntu 18.04). But I'm having troubles controlling the trigger position in the buffer of 8192 samples. I want the event of interest located on the right end, so that the buffer captures what happened *BEFORE* it, instead of after it (to avoid repeated patterns.) I'm looking for a narrow spike >5V to trigger. There is only one such data point in the buffer of samples, and I can verify that. My code looks like this but the trigger position is not fixed in each run. Some times the >5V point is very early in the buffer. Thank you! // Modified from sample code: analogin_acquisition.cpp // sample rate // 50,000 Hz, 8192 samples, // 163.84 ms range // 0.00002s or 20 us between samples FDwfAnalogInFrequencySet(hdwf, 50000.0); // configure trigger FDwfAnalogInTriggerSourceSet(hdwf, trigsrcDetectorAnalogIn); FDwfAnalogInTriggerTypeSet(hdwf, trigtypeEdge); FDwfAnalogInTriggerConditionSet(hdwf, trigcondRisingPositive); FDwfAnalogInTriggerLevelSet(hdwf, 5.0); FDwfAnalogInTriggerHysteresisSet(hdwf, 0.05); FDwfAnalogInTriggerHoldOffSet(hdwf, 0.15); // cycle is 0.16 // set trigger position to the right // time range is (-82 ms, 82 ms) FDwfAnalogInTriggerPositionSet(hdwf, 0.08); // <-------- look here FDwfAnalogInConfigure(hdwf, 0, true); Digilent.adept.runtime_2.21.3-amd64.deb Digilent.waveforms_3.16.3_amd64.deb The WaveForm application works properly with the same parameters.
  6. I am using the Waveforms software as an oscilloscope and I can see the sample rate, but I need to know how fast it's triggering. I am trying to compare the trigger rate at different trigger levels, which is a number I can get on my normal oscilloscope but I don't know how to get on this software. My only thought was setting up a custom measurement, but I'm not sure what exactly that would look like or if that would work. Thanks for any help!
  7. New Digital Discovery user. I did not purchase this device for its excellent documentation or thorough applications examples (which are not so great), but because it can capture SPI at 800MHz with the special adapter. I understand that the Digital Discovery will stream the captured data to memory and I can save it to disk. I'm debugging a difficult SPI issue, and need to see as much detail as possible (hence the 800MHz). Out test code captures some 30,000 rows of 14 consecutive 14-bit reads at an SPI clock speed of 27.5 MHz. This is a whole lot of data. We need to see the protocol capture results and compare it with what our embedded system is reporting. We read a very slow, clean R/C ramp (falling), gather all the data, and create a statistical plot which tells us how many "hits" we get on a certain bin value. Here's a snip: In this example, and despite the fact that our input ramp is changing in a very linear fashion (and therefore we should see equal distribution), decimal 4083 (ending in 100011) has far fewer hits than those adjacent. Each column (in the green) is a single SPI read of our ADC. We do 14 through DMA (very fast), and then repeat without much delay. I thought Digital Discovery would (a) trigger on the falling chip select, and (b) keep recording the data stream (ignoring subsequent chip select cycles). It doesn't. Instead, it captures the first 14 samples and no more data after that. Hopefully it's possible to trigger on CS (going low) and just keep sampling until I press stop. (Ideally if there's a timeout value allowing us to stop once CS stays high for a certain duration, that would be ideal). Finally, I have no idea how to save my data to a file and in a certain format. My setup: Please help this new user. I suspect it's simple, but the online docs are not very revealing, and experimentation isn't getting me far. Thanks!
  8. Hello, i am trying to trigger an High Speed Pin after a certain length of a pulse. With the waveform software this works perfectly. Inside my c# code the "dwf.FDwfDigitalInTriggerLengthSet" has no effect. It doesn´t matter if i use 30ns or 10s for the minimum length. -> It triggers always directly after the first glitch of about 10ns. Thank you for your help in advance. Steven What am i doing wrong? Here the code: //Number of samples to acquire after the trigger (10 bit with 10Mhz) int number_of_samples = Convert.ToInt32(_frequency/(1e6)); //Digital In //Set State to Configure dwf.FDwfDigitalInConfigure(_hdwf, 0, 0); //First reset dwf.FDwfDigitalInReset(_hdwf); //Get the internal clock frequency double hzSys = 0; dwf.FDwfDigitalInInternalClockInfo(_hdwf, out hzSys); //Set the frequenzy of the signal in Hz UInt32 divider = Convert.ToUInt32(hzSys / _frequency); dwf.FDwfDigitalInDividerSet(_hdwf, divider); //set record mode //in record mode samples after trigger are acquired only dwf.FDwfDigitalInAcquisitionModeSet(_hdwf, dwf.acqmodeRecord); //Set the sample format to 8 bit (1 Byte) dwf.FDwfDigitalInSampleFormatSet(_hdwf, 8); // number of samples after the trigger dwf.FDwfDigitalInTriggerPositionSet(_hdwf, Convert.ToUInt32(number_of_samples)); //Number of samples to acquire before the trigger (20) dwf.FDwfDigitalInTriggerPrefillSet(_hdwf, 20); //Set the channels to record List<Byte> Record_PIN = new List<Byte>(); //Set the channels to record 0,1,2 Record_PIN.Add(0); Record_PIN.Add(1); Record_PIN.Add(2); dwf.FDwfDigitalInSampleSensibleSet(_hdwf, create_Bit_field_32(Record_PIN)); // Set Sample Mode Simple (One Sample every divider clock pulse) dwf.FDwfDigitalInSampleModeSet(_hdwf, dwf.DwfDigitalInSampleModeSimple); ////Sample settings //Configure the order of the sample array (DI first) dwf.FDwfDigitalInInputOrderSet(_hdwf, 0); //Set Trigger Mode to "normal" dwf.FDwfDigitalInTriggerAutoTimeoutSet(_hdwf, 0); //Set Trigger to channel 2 List<Byte> Trigger_PIN = new List<Byte>(); //Trigger_PIN.Add(1); Trigger_PIN.Add(2); dwf.FDwfDigitalInTriggerSet(_hdwf, 0, create_Bit_field_32(Trigger_PIN),0 , 0); //Set TriggerLength to minimum 50ns dwf.FDwfDigitalInTriggerLengthSet(_hdwf, 50e-9, -1, 0); //Set Trigger to DigitalIn dwf.FDwfDigitalInTriggerSourceSet(_hdwf, dwf.trigsrcDetectorDigitalIn); //Acquire and Start Recording //Start acquiring dwf.FDwfDigitalInConfigure(_hdwf, 1, 1);
  9. Hi, I'm recently working on the Waveforms SDK with the Analog Discovery 2. I manage to trigger my AnalogIn with the AnalogOut sinus that I generate. My aim is to acquire my sinus in order to calculate the phase shift. Is there a way to get the delay between the start of the AnalogOut generation and the trigger pulse attached to it ? Thank you. Here is the code that I'm using : FDwfAnalogOutNodeEnableSet(hdwf, 0, AnalogOutNodeCarrier, true); FDwfAnalogOutNodeFunctionSet(hdwf, 0, AnalogOutNodeCarrier, funcSine); FDwfAnalogOutNodeFrequencySet(hdwf, 0, AnalogOutNodeCarrier, 1000.0); FDwfAnalogOutNodeAmplitudeSet(hdwf, 0, AnalogOutNodeCarrier, 1); FDwfAnalogOutNodeOffsetSet(hdwf, 0, AnalogOutNodeCarrier, 1); FDwfAnalogOutRunSet(hdwf, 0, 2.0/1000.0); FDwfAnalogOutRepeatSet(hdwf,0,0); FDwfAnalogOutConfigure(hdwf, 0, true); FDwfAnalogInTriggerAutoTimeoutSet(hdwf, 0); FDwfAnalogInChannelRangeSet(hdwf, 0, 5); FDwfAnalogInBufferSizeSet(hdwf, 40); FDwfAnalogInFrequencySet(hdwf, 10000.0); FDwfAnalogInAcquisitionModeSet(hdwf, 0); FDwfAnalogInTriggerSourceSet(hdwf, trigsrcAnalogOut1); FDwfAnalogInTriggerTypeSet(hdwf, trigtypeTransition); FDwfAnalogInConfigure(hdwf, 0, true); while(true){ FDwfAnalogInStatus(hdwf, true, &sts); if(sts == DwfStateDone){ break; } } FDwfAnalogInStatusData(hdwf, 0, rgdSamples, 40); // This acquisition ins not starting at the offeset point but at the falling edge
  10. I build radar systems for a living, and I'm testing the Analog Digilent 2 as an A/D, timing control for other RF hardware, RF switch control, trigger source. Here's what I need to do: Write the software with python using the Waveforms SDK running on Windows 10. Acquire signals on 2 analog channels simultaneously. This must be triggered at a periodic rate on an input other than the two analog in channels. Generate a pulse width of p nanoseconds at an x kilohertz rate. This is a TTL signal. This pulse is used for RF pulse generation, but also as a trigger for the analog channels. All digital out signals must be synchronized. Capture n samples on both channels for a maximum of 256 triggers. Typically 128 or 256 is used -- a 2^n number of triggers is used for FFT processing. Capture to arrays (or lists in the case of python) must be real time. Rearrange the lists so that an FFT can be taken from the ith sample of each trigger event. So if I have 128 trigger events, and I capture 1024 samples on each event, then I take 128 values from index 0 of all trigger events and compute a complex FFT. Then I repeat for index 1, 2, … 1024. In radar terms, each sample relates to a range value. If sampling at 80 MSPS, each sample equates to 2 meters of range. So 1024 samples = 2048 meters of total range. The complex FFT computes the Doppler frequencies seen for each of those sample range points. Progress: A. I have successfully used the example SDK program named Digital_Duty.py to generate a x kHz pulse rate with p width in nanoseconds. I modified it to continue doing it until the program is terminated. The test values are 4 kHz pulse rate (trigger rate) and the pulse width is 300 nanoseconds. The output is on DIO Channel 1. The AD2 works great at this. B. I have successfully used the example SDK program named AnalogIn_Trgger.py to acquire signals. I modified this source to: digitize Channel 0 and Channel 1; trigger on an External Trigger, which is now the inputted by placing a jumper wire between DIO Channel 1 and Trigger 1 Channel; Continue to trigger for 128 times; Plot last set of data. C. I am using a 10 MHz and 20 MHz signal on Channel 0 and Channel 1, respectively. This is correctly plotted by the application. D. I was delighted to see the code was working...or so I thought. I added a time check to confirm 128 triggers were completed in the appropriate time. The time check came back as 0.156 seconds for 128 triggers of 1024 samples. The answer should have been (1/4000)*128 = 0.032 seconds. So my capture time was almost 5 times too long. I confirmed that even with two pulses the system cannot transfer fast enough. And even if I get down to 10 samples per trigger, there is little change in timing. I computed that the fast PRF (trigger event speed) = about 850 Hz. There is still some unexplained overhead time, but it is close to that number. So keeping under 850 Hz, the system is real time. Unfortunately, that equates to about 14 mph at usable radar frequencies. I need to get up to about 4000 Hz to be of use. See my attached Code written in python. I am using a Windows 10 Pro laptop running an i7 processor with 64 GB of RAM. I have the AD2 plugged into a spare USB port. 10 and 20 MHz signals feed the analog channels from a crystal oscillator as a test of the capture. I have available external waveform generators, oscopes, and spectrum analyzers. So given my test in D, does anyone know what I can do to improve performance? Is there something wrong in my code? Am I misunderstanding the capabilities of the AD2? If the system had a USB 3.0, I know it would be able to keep up. But given that is not available, what should I try if anything? Radar Data Capture With Internal Trigger.py
  11. Because the ScanScreen and ShiftScreen acquisition modes ignore triggers, how do I know precisely when they start the first acquisition? Is it possible to start the analog and digital scan-acquisitions simultaneously to ensure that both data streams are reading/displaying with a common time axis? Or do I misunderstand how these types of acquisition work? My previous approach was to generate a slow pulse and use the rising edge as a trigger to simultaneously start single acquisitions on both analog and digital scopes, then plot and repeat on the next pulse. But this is tedious, I can't get it to play nice with threading, and it means I only get snapshots of my data instead of seeing the whole stream. Thoughts?