Search the Community

Showing results for tags 'trigger'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • News
    • New Users Introduction
    • Announcements
  • Digilent Technical Forums
    • FPGA
    • Digilent Microcontroller Boards
    • Non-Digilent Microcontrollers
    • Add-on Boards
    • Scopes & Instruments and the WaveForms software
    • LabVIEW
    • FRC
    • Other
  • General Discussion
    • Project Vault
    • Learn
    • Suggestions & Feedback
    • Buy, Sell, Trade
    • Sales Questions
    • Off Topic
    • Educators
    • Technical Based Off-Topic Discussions

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 25 results

  1. 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!
  2. 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!
  3. 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);
  4. 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
  5. 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 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 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
  6. 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?
  7. I would like to know if it is possible to acquire more than one time the buffer on single buffer acquisition (acqmodeSingle) for continuous data after trigger. I want to aqcuire 10 times the buffer on frequency of 100MHz with 8192 buffer size.
  8. I am using analog discovery 2. I am trying to acquire data (for 10ms) of first channel from trigger of second channel signal. this is a part of my code hzAcq = c_double(1075000) # 1,075MHz nSamples =8192 dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(0), c_bool(True)) #first signal (channel 1) dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(0), c_double(1)) dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(1), c_bool(True))#second signal (channel 2) dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(1), c_double(5)) dwf.FDwfAnalogInAcquisitionModeSet(hdwf, c_int(3)) # record dwf.FDwfAnalogInFrequencySet(hdwf, hzAcq) sRecord = nSamples/hdwf.value # 7.6ms dwf.FDwfAnalogInRecordLengthSet(hdwf, c_double(sRecord)) # -1 infinite record length dwf.FDwfAnalogInTriggerPositionSet(hdwf, c_double(-0.25*sRecord)) # -0.25 = trigger at 25% #set up trigger dwf.FDwfAnalogInTriggerAutoTimeoutSet(hdwf, c_double(10)) # 10 second auto trigger timeout dwf.FDwfAnalogInTriggerSourceSet(hdwf, c_ubyte(2)) # trigsrcDetectorAnalogIn dwf.FDwfAnalogInTriggerTypeSet(hdwf, c_int(0)) # trigtypeEdge dwf.FDwfAnalogInTriggerChannelSet(hdwf, c_int(1)) # channel 2 dwf.FDwfAnalogInTriggerLevelSet(hdwf, c_double(1.5)) # 1.5V dwf.FDwfAnalogInTriggerHysteresisSet(hdwf, c_double(0.01)) # 0.01V dwf.FDwfAnalogInTriggerConditionSet(hdwf, c_int(0)) # trigcondRisingPositive the first signal is on mV and the second is a signal on V ( 0-3.3 ) The voltage values that i acquire are not correct. Any suggestions?
  9. I am kind of new on electronics. I am trying to set a trigger connection to analog discovery 2(AD2) from matlab. Since matlab has a supporting package of AD2 for data acquisition tool, I tried to set a trigger with the function addTriggerConnection() but i got the message You cannot use "addTriggerConnection" with Digilent hardware. Is there any other suggestions on how to trigger data Recording from matlab data acquisition tool for AD2.
  10. Hello I certainly miss something, but I cannot figure out how to trigger pattern with an AWG output. According to the reference manual: Each instrument generates a trigger signal when a trigger condition is met. It's rather easy to trigger the AWG and the pattern output with the scope, but I didn't figure out how to trigger patterm output with AWG. I certainly didn't found what a "trigger condition" is for an AWG. What I'm trying to do is to have two AWGs synchonized and one positive pulse at phase 0. I can imagine to use Ext trigger, and to wire T1 on T2, but that doesn't seems to make sens. Thanks for your help. default.dwf3work
  11. Hi all, I have recently bought 2 digital discoveries to go with an existing Analog Discovery 1, and Analog discovery 2. I would also like to use the 2 digitals as a standalone pair with no analog in the system. The store webpage for the discovery mentions trigger in and out signals for linking devices. This is one of the reasons I purchased them as I currently need >32 channels. I can't see these signal in the pinout anywhere, and nothing in waveforms about this feature. I have tried to generate a pulse on one of the digital IOs using the pattern generator triggered from the logic, but I cannot get a single repeated trigger pulse, it seems to either be one shot or a continuous un-synced pulse train once triggered. Any help or advice would be greatly appreciated. Thanks, Dean
  12. Hi, and thanks for the support so far. After a lot of experimenting and reading the help, I'd like to understand the "envelope" of possible triggered, repeated, logged acquisitions, which can run unattended for days or weeks. We need to leave a system in an inaccessible location and log at least 4 analog channels with at least 100 KHz sample rate, for a time of at least 100 usec after the trigger occurs for each triggered event. We believe these events have a time frame of 5 or so 60 Hz cycles, so that's 85 msec post-trigger and we'd like a cycle or two (16 or 32 msec) of pre-trigger. These events are rare and not on a predictable timetable. So we are rather searching for a needle in a haystack and we hope to find evidence it exists. Here I am talking about Scope function (Logger's sample rate of 100 msec is too slow for this case) and there are still many details I don't claim to understand. But since I need to make a report of what is possible with AD2, here goes. Record mode can capture much longer numbers of samples Device manager determines what is possible (e.g. Patterns) but some things seem ignored (e.g. Scope samples) Sample rate, number of samples, and pre-trigger samples are set with the "Config" button with the green diode-like symbol. This is intuitive with a % of total acquisition setting for trigger location. Zooming and scrolling in the display window does not change what you set with the Config button so subsequent captures use the same config. Actual sample rate and length is limited by USB connection speed to the host PC. On a 1.7 GHz dual core Linux with 16 GB RAM and SSD, it seems to be limited to 200 KHz sample rate. At 100 KHz we can capture up to 10 M samples, for a 100 second acquisition Acquisition in "record" mode can only be started with a button click and cannot be triggered by normal scope triggers even though those settings are still present on the GUI. Pressing Record is the only way to start capture and that immediately captures one acquisition. It can't wait for trigger conditions to be met. An acquisition can be saved using the logging settings if set for "each triggered acquisition", even though it really wasn't 'triggered'. Also "each acquisition" works. In record mode, if Device Manager is set to allow it, Patterns can work to use Scope Detector to make an external trigger output on a DIO pin, and this will trigger on the stated conditions but only *after* the Scope Record button is clicked. And I also have to remember to separately click the Pattern Run button or its output won't generate This can only record a single event and you have to click on the Scope Record button to start the acquisition. So Record mode won't work for us. In "repeated" mode, the scope will use the trigger settings Device Manager determines how many samples can be captured: 8K or 16K are the highest options of the 6 available and those seem to be the only ones possible. so it can wait until trigger conditions occur, then capture each time the trigger conditions are met. Sample length is a max of 16384 samples Settings - Options can make one of the trigger pins "Scope" which generates a single rising edge trigger per acquisition, to trigger other AD2s or other logging devices Sample rate and pre-trigger are confusing in repeated mode. It appears they can be set in the Time dialogs, also number of samples, pre-trigger (the "position" setting), but this interacts with the scope display screen: zooming and panning changes your intended settings. There seems to be no way to lock them like on a traditional desktop DSO. It's nothing like Config in Record mode. The display has 10 divisions so if I want to trigger at 2 divisions I'm better off to drag the white triangle on the top of the scope display to 2 divisions from the left. In repeated mode, Trigger takes place at time 0 and pretrigger time is negative. So for 16K samples at 100 KHz, that is about 16 msec/div. Trigger two divisions from left makes the leftmost time -32 msec and Time "Position" 48 msec, which doesn't make any sense to me. Time Base is 16 msec/div as expected. Don't dare zoom in the scope display or the time settings will also change, changing the next triggered acquisition! If you do this by accident its a tedious, multi-click process to get back to the settings you intended. At 100 KHz 16384 samples is 168 msec, long enough for us, we hope. At 8K samples we'd have to drop to 50 KHz samples Clicking Run button means scope will wait for trigger satisfied, then log both channels to PC memory, auto-incrementing the file name File name can include day hour min sec which is handy. Be careful entering this information or Waveforms will crash. I'll post a bug elsewhere. Full timestamp and setting values are included in the .csv log file You specify how many acquisitions to save, at which point logging halts. 1,000,000 is the largest number I could set. Saving workspace sometimes causes a ghost progress window which can be cleared with another save. So Repeated mode will work for us, with the limits of 16K @ 100 KHz samples Each 2-channel 16K log file is about 984 KBytes. As each 16K sample file is a bit under 1 MByte, you get 1000 log files per GB. Summary: For unattended, auto trigger and acquisition of multiple events, and logging to a computer file, "repeated" mode is the only option. We can log two analog channels per AD2, plus digital inputs if we wish. External trigger output: one rising edge per triggered acquisition. Trigger goes low at end of acquisition. Trigger other AD2s or external equipment. Samples per acquisition are 16K or 8K Logging can occur up to the maximum value you set (up to 1 M acquisitions), or the PC runs out of disk space, at about 1 MByte per 16K acquisition.
  13. Dear colleagues, is there any possibility to set(configure) the trigger output pulse length? I have two discoverys, and one somehow provides 125us, while the other 350us. They might have been set for different value, but I do not know ho to (re)set them. Thanks for your help in advance, Miklos
  14. Hi All I used AD2 with a Digilent Impedance Add-on board, and absent-mindedly pulled it off while it was still on and active! The result is that, although the impedance measuring process works ok, and I can use the wavegen 1/2 on the scope 1/2 with jumpers externally, it won't trigger internally now. A curious thing is that in Static DIO, the pins react with a flickering when I run my fingers along the pins. Looking at the CCT, it seems I could have damaged the internal digital 3.3V supply, IC30 AD2503, which just seems to be for the diode protection ccts of the dio's. What to do do now? I Re-installed Waveforms, reset calibration...
  15. Hello there, I am a new user to the AD2 scene. What I am trying to do is create a parallel wire capacitor that will alternate the charge on the wires at a freq of 200kHz, at a voltage of 2V across the capacitor wires (in this case the wires are the male connectors) My first question is if I use the wavefunction generator as a sine wave, does the ground need to be placed on the adjacent wire to create my capacitor? What I mean is that if the W1 channel is pushing 2V to the W1 wire, is that in relation to the ground wire? Or, do I need to set up a second wavefunction generator to simultaneously be 180 out of phase, and push -2V to the W2 wire, and have that be the wire adjacent to W1 in my wire capacitor to create the E field between the two wire capacitors? I suspected that I would need a wavefunction generator for each of the wires in my system, so this leads me to the next question. If I need to create two sets of alternating parallel wire capacitors, then I will need 4 wavefunction generators at 200kHz, and thus will need atleast two AD2 devices that can trigger one another. I read the tutorial on using an external push button act as the trigger device. Could I buy a external push button that I could link to both devices? If so, could someone show me which one? Secondly, my other question is that if there is a way to use a keyboard button to be your external trigger? Thank you so much for your help!
  16. Hi, I am trying to capture a periodic negative pulse which duration is less than 10 us. If I set trigger to pulse, condition to negative and Lcondition to more than 5 us, the trigger works as expected and a negative pulse of approx 5.5 us is captured. However, when I set the Lcondition to less than 10 us (5.5 us is obviously less than 10 us) it won't trigger.
  17. I'm currently trying to synchronize analog pulses on both AWGs with digital pulses, and simultaneously run both analog scopes and the digital scope. I am trying to trigger all outputs and all scope acquisitions to happen simultaneously with a single PC-Trigger source using the SDK. First question: Why isn't there an AnalogInTriggerSlopeSet function? (You can set the TriggerSlope to rising edge for AnalogOut, DigitalOut, and DigitalIn). Without an AnalogInTriggerSlopeSet function, how do you set the AnalogInTrigger to respond to the same signal as the other three? Second Question: What prompts the change in Analog/DigitalInStatus from 'prefill' to 'armed' or 'done'? In the Acquisition code in the SDK, it looks like the status changes when the buffer fills? In my code below, why isn't it progressing to 2=Done to break out of the loop? It looks like it is getting stuck waiting for the trigger (which already happened). #digital pulse control setup self.dwf.FDwfDigitalOutEnableSet(hdwf, c_int(0), c_int(1)) # enable dIO pin 0 self.dwf.FDwfDigitalOutDividerSet(hdwf, c_int(0), c_int(int(hzSys.value/(100*self.qRate)))) # divider=internal clock/ (100counts*frequency) self.dwf.FDwfDigitalOutCounterSet(hdwf, c_int(0), c_int(100-self.qDuty), c_int(self.qDuty)) # set counts low, counts high from duty cycle print "configured digital output" # analog pulse control setup self.dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(0), AnalogOutNodeCarrier, c_int(True)) self.dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(1), AnalogOutNodeCarrier, c_int(True)) # for second channel set master the first channel, slave channel is controlled by the master self.dwf.FDwfAnalogOutMasterSet(hdwf, c_int(1), c_int(0)); self.dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(-1), AnalogOutNodeCarrier, funcSquare) self.dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(-1), AnalogOutNodeCarrier, c_double(self.xRate)) self.dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(-1), AnalogOutNodeCarrier, c_double(0.5)) self.dwf.FDwfAnalogOutOffsetSet(hdwf, c_int(-1), c_double(0.5)) self.dwf.FDwfAnalogOutNodeSymmetrySet(hdwf, c_int(-1), AnalogOutNodeCarrier, c_double(symm)) #pulse width self.dwf.FDwfAnalogOutNodePhaseSet(hdwf, c_int(1), AnalogOutNodeCarrier, c_double(self.x2Phase)) #phase shift for second channel self.dwf.FDwfAnalogOutRunSet(hdwf, c_int(-1), c_double(self.xDuration)) #set run duration on all channels self.dwf.FDwfAnalogOutIdleSet(hdwf,c_int(-1), c_int(0)) print "configured analog output" #configure digital input scope self.dwf.FDwfDigitalInDividerSet(hdwf, c_int(int(hzSys.value/(100*self.xRate)))) #same sample rate as xray self.dwf.FDwfDigitalInSampleFormatSet(hdwf, c_int(16)) # 16bit per sample format cSamples = 1000 # set number of sample to acquire rgwSamples = (c_uint16*cSamples)() self.dwf.FDwfDigitalInBufferSizeSet(hdwf, c_int(cSamples)) print "configured digital input" #configure analog input scope self.dwf.FDwfAnalogInFrequencySet(hdwf, c_double(int(hzSys.value/(100*self.xRate)))) self.dwf.FDwfAnalogInBufferSizeSet(hdwf, c_int(1000)) self.dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(0), c_bool(True)) self.dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(0), c_double(5)) self.dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(1), c_bool(True)) self.dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(1), c_double(5)) rg1 = (c_double*1000)() #rg = pointer to allocated buffer to copy the acquisition data rg2 = (c_double*1000)() #rg = pointer to allocated buffer to copy the acquisition data print "configured analog input" #set up PC trigger to start pulse output AND acquisition self.dwf.FDwfAnalogOutTriggerSourceSet(hdwf, c_int(0), trigsrcPC) self.dwf.FDwfDigitalOutTriggerSourceSet(hdwf, trigsrcPC) self.dwf.FDwfAnalogOutTriggerSlopeSet(hdwf, c_int(0), c_int(0)) # set channel 1 to trigger on rising edge self.dwf.FDwfDigitalOutTriggerSlopeSet(hdwf, c_int(0)) self.dwf.FDwfDigitalInTriggerSourceSet(hdwf, trigsrcPC) self.dwf.FDwfDigitalInTriggerSlopeSet(hdwf, c_int(0)) #rising edge self.dwf.FDwfAnalogInTriggerSourceSet(hdwf, trigsrcPC) # self.dwf.FDwfAnalogInTriggerSlopeSet(hdwf,) #this command doesn't exist for analogin! print "set up triggers" #configure everything to wait for trigger self.dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_bool(True)) # start master, slave will follow self.dwf.FDwfDigitalOutConfigure(hdwf, c_int(1)) self.dwf.FDwfDigitalInConfigure(hdwf, c_bool(0), c_bool(1)) self.dwf.FDwfAnalogInConfigure(hdwf, c_int(1), c_int(1)) # starts both analog in pins (hdwf, bool-reconfigure, bool-start) print "initialized pins" #send the trigger self.dwf.FDwfDeviceTriggerPC(hdwf) print "PC trigger pulse sent" #plot the things sts = c_int() while True: #data acquisition status should == 5 - filling buffer self.dwf.FDwfDigitalInStatus(hdwf, c_int(1), byref(sts)) sts1 = sts.value self.dwf.FDwfAnalogInStatus(hdwf, c_int(1), byref(sts)) print ("analog status = " + str(sts.value)) print ("digital status = " +str(sts1)) if sts.value == DwfStateDone.value : #status ==2 = done print "acquisition complete" break When I run this, this is my printout:
  18. """ DWF Python Example Author: Digilent, Inc. Revision: 2015/02/05 Requires: Python 2.7 Start synchronized the AWG outputs of multiple Analog Discovery devices. Connect the Trigger-1 pin of each device together. """ from ctypes import * import time import sys if sys.platform.startswith("win"): dwf = cdll.dwf elif sys.platform.startswith("darwin"): dwf = cdll.LoadLibrary("libdwf.dylib") else: dwf = cdll.LoadLibrary("") #print DWF version version = create_string_buffer(16) dwf.FDwfGetVersion(version) print "DWF Version: "+version.value cDevice = c_int() dwf.FDwfEnum(c_int(2), byref(cDevice)) # 2 = enumfilterDiscovery print "Found "+str(cDevice.value)+" devices" cChannel = 2 cOutput = cDevice.value*cChannel hdwf = c_int() #open device for iDevice in range (0, cDevice.value): dwf.FDwfDeviceOpen(c_int(iDevice), byref(hdwf)) if hdwf.value == 0: print "failed to open" quit() for iChannel in range (0, cChannel): print "Configure "+str(iDevice+1)+"/"+str(iChannel+1) # enable channel dwf.FDwfAnalogOutNodeEnableSet(hdwf, c_int(iChannel), c_int(0), c_int(True)) # 0 = AnalogOutNodeCarrier # configure dwf.FDwfAnalogOutNodeFunctionSet(hdwf, c_int(iChannel), c_int(0), c_int(1)) # 1 = funcSine dwf.FDwfAnalogOutNodeFrequencySet(hdwf, c_int(iChannel), c_int(0), c_double(1000.0)) dwf.FDwfAnalogOutNodeAmplitudeSet(hdwf, c_int(iChannel), c_int(0), c_double(1.0)) # set trigger source to external trigger 1 dwf.FDwfAnalogOutTriggerSourceSet(hdwf, c_int(iChannel), c_byte(11)); # 11 = trigsrcExternal1 #set different phase iOutput = iDevice*cChannel+iChannel dwf.FDwfAnalogOutNodePhaseSet(hdwf, c_int(iChannel), c_int(0), c_double(360.0*iOutput/cOutput)) # start the channel, this will wait for the trigger dwf.FDwfAnalogOutConfigure(hdwf, c_int(iChannel), c_bool(True)) # configure Trigger-1 pin to output the triggerPC signal for the last device dwf.FDwfDeviceTriggerSet(hdwf, c_int(0), c_byte(1)) # 1 = trigsrcPC # after open, before the first run wait a bit for the offsets to stabilize time.sleep(5) print "Pulse trigger to start generation..." dwf.FDwfDeviceTriggerPC(hdwf); time.sleep(60) print "done." dwf.FDwfDeviceCloseAll()
  19. Hi all, brand new to the forum and just received my analog 2 discovery. Pretty impressed with it so far. Actually I'm working on an interrupt driven spi interface to a SPI accelerometer. All is working well, but I would like to configure a button...say in the Static I/O tool, or the patterns tool whereby it can represent my interrupt in. I want to be able to trigger a single interrupt, this will trigger my Interrupt Service Routine, my scope and logic analyzer and I will be able to observe the Single SPI transaction. So, restating the question : "I just want to configure a pushbutton using a Analog discovery 2 instrument that will act like a button driving a one shot (Monostable Multivibrator in the ancient vernacular) with a pulse length of about 20us. I push the button say in the Static logic tool and 20 us later it returns to zero. Any quick ideas here...I could probably read a while and figure out a strategy but I'm looking for a quick fix.. Thanks. Glen
  20. How can Analog Discovery 2 O-scope acquire data after a given time delay after a trigger, or after a given number of triggers on Scope Channels 1 or 2? This is a common function on older scopes, can AD2 perform this function? Thank You - Phil S
  21. In Waveforms 2015, is it possible to set up a wave in the AWG to be triggered by every other pulse in the scope? I'm currently trying to use a 10 Hz external pulse connected to the Analog Discovery's scope as the trigger for a 5 Hz waveform from the AWG, but I need to have the event trigger only once the 5 Hz waveform has finished one pulse. Effectively, I'm putting together a slower trigger for one device that's triggered from the AD's scope using a faster external pulse. It appears that Waveforms 2015 has some logic capabilities incorporated into the software, but as I don't have a background in logic circuits I'm not even sure if the logic circuit feature can work this problem out. Any help with this will be much appreciated~
  22. Just "discovered" the AD2 and am very interested in it. There is a lot of features packed into a small package. One thing seems to be missing and I was wondering why. There is no external analog trigger. If I want to trigger on a specific voltage in a waveform, I have to use one of the two oscilloscope inputs. Why was this left out? Seems like it would be simple to add a comparator and use a DC voltage from the ADC to set the trigger level.
  23. Hi, I wrote a small programm to test the speed limitations of triggering and I have a problem: After collecting data the setup for the next trigger takes 15ms. The application I'm building requires to capture 10ms of data with 100000 Hz, so I want to capture 1000 samples. After that I only have 10ms to setup the next trigger. The programm collects all the triggers with not too many samples. But if I capture more than 500 samples (5ms) then I start missing triggers. What can I do to do this high speed data acquisition with the Analog Discovery 2? This is the cpp-Code I use: #include <signal.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include "sample.h" int bufferSize = 500; // int bufferSize = 600; // int bufferSize = 1000; int terminate = 0; void my_handler(int s) { terminate = 1; } int main(int carg, char **szarg) { signal (SIGINT, my_handler); HDWF hdwf; STS sts; printf("Open automatically the first available device\n"); if(!FDwfDeviceOpen(-1, &hdwf)) { printf("Device open failed"); return 0; } FDwfAnalogInFrequencySet(hdwf, 100000.0); FDwfAnalogInBufferSizeSet(hdwf, bufferSize); FDwfAnalogInChannelEnableSet(hdwf, 0, true); FDwfAnalogInChannelRangeSet(hdwf, 0, 4.99); // disable auto trigger FDwfAnalogInTriggerAutoTimeoutSet(hdwf, 0); // one of the analog in channels FDwfAnalogInTriggerSourceSet(hdwf, trigsrcExternal1); FDwfAnalogInTriggerTypeSet(hdwf, trigtypeEdge); FDwfAnalogInTriggerChannelSet(hdwf, 1); FDwfAnalogInTriggerLevelSet(hdwf, 1.5); FDwfAnalogInTriggerConditionSet(hdwf, trigcondRisingPositive); // wait for the offset to stabilize Wait(2); printf("Starting repeated acquisitions:\n"); int iTrigger; for(iTrigger = 0; iTrigger < 200; iTrigger++){ // begin acquisition FDwfAnalogInConfigure(hdwf, false, true); while(true){ FDwfAnalogInStatus(hdwf, true, &sts); if(sts == DwfStateDone) { break; } if (terminate == 1) { break; } } if (terminate == 1) { break; } } printf("#%i\n", iTrigger+1); FDwfDeviceCloseAll(); } Compile it with gcc -ldwf trigger.c && ./a.out It waits for triggers on external trigger source 1. The only way I see to solve this is to not care about triggers and capture the whole signal but I would really like to solve it in a nice way. Thank you for your replies Daniel
  24. I have a weird issue with my Analog Discovery 2 and I was wondering if there are ideas out there how to track it: I use a Digilent Adept with the Waveforms 3.3.7 software on linux. It seems to work fine but does not detect my triggers. If I use the provided pyhton examples or C examples trigger detection does not work meaning the program just stays in "Waiting for trigger" state all the time. But if I use the dwfcmd: cd /usr/share/digilent/waveforms/samples/dwfcmd && dwfcmd analogintrigger.txt I get one trigger without a problem. It took me so much time to detect this behavior and now I don't have any idea how to solve this. The dwfcmd is not powerful enough for my application but maybe I'll end up modifying the code to fit my needs. I'd really like to keep using python, any ideas what I am doing wrong or any known bugs? Thanks Daniel Rech
  25. Hello Probably i want order a Analog Discovery. Before that i have some requirements/questions about the possibilities of the equipment/ software. 1) Can i record my Inputs/ Outputs related/synced to each other? This for later calculations in GNU Octave… (fs_max = 200 kHz) 2) Is it possible to record inputs and outputs based on a trigger in one of the recorded signals. Let say i record 2 inputs and the trigger is one of the inputs?. Is this trigger adjustable? So that in a noisy environment the trigger not start. 3) I Work mostly with OSX or Ubuntu and I don't have experience with programming outside GNU Octave/ Matlab. What are the possibilities of WaveForm SDK and GUI? Is that something what is easy to learn are there some tutorials or other stuff? 4) Is it posible to work with (long) delays? sends signal on OUT1 and about 1 sec later i get a (complex and longer) response on IN1 how to deal with this. including recording of question 1 Thanks Jan-Bert