Jump to content
  • 0

TurgidWater45

Question

Hello,

I'm a bit confused as to how the Waveforms manages its buffer. I'm using the Waveforms SDK (via LabVIEW) to both generate a pulse and act as a scope using the Analog Discovery Kit 2. I am generating a 50 ms, 5V pulse with a frequency of 230 kHz. This is connected to a hardware device. I then want to use the scope function to record the output form this device. I can get the scope to read, but I don't really understand why it works the way that it does.

As it stands, the only way that I can consistently get a waveform is as follows (AnalogIn):

AutoTimeout: 0.5

Sample Frequency: 160 kHz

AcquisitionMode: Record

RecordLength: 2 seconds

I also have a 2.5 second wait on my analog out.

If any of these settings change, my waveform will not show up. If perhaps I want a 200ms pulse, I need to change the sample frequency to 40 kHz.

Attached is a screenshot of what the waveform looks like. There are two problems with this. The waveform is pushed far to the right. I want the waveform to take up the entire buffer. Second, if I'm sweeping frequencies, the waveform will show up at slightly different spots between frequencies. My ideal situation is that the ADK2 outputs a pulse, and when the pulse starts it immediately begins to record, filling the buffer after 50 ms. This buffer is emptied into an excel document, and then awaits use again.waveformcapture.thumb.PNG.eb3177bb43dc3a6bc753c68bfe68b3b5.PNG

I've searched and read through the SDK reference manual but I can't seem to get a grasp on how to fix this. I feel like it's a lack of understanding of how the buffer is managed, but any help would be appreciated.

Thanks

EDIT: Follow-up/related question: How would these settings translate into SDK functions? 

settingwwaveform.thumb.PNG.0a1f108d4c1f8131dd255e93d408e636.PNG

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Hi @TurgidWater45

In record mode the trigger position is relative to the left or the capture, first sample.
The configuration for your last screenshot looks like this:
FDwfAnalogInRecordLengthSet(hdwf, 0.1) # 100ms 
FDwfAnalogInTriggerPositionSet(hdwf, -0.01) # -10ms 

After starting it, the Scope will stream data until prefill expires (-position) 10ms. Then it will arm looking for trigger and continues data streaming. After trigger event it will stream for (record_length + position), 90ms.
After the record is done the data needs to be aligned, so that the last returned sample to be the last in your buffer, last + one to be the first.
Having trigger position 0 for record mode the streaming will only start after triggering, so no alignment is needed.

Here you have a Python example for record with trigger at 25%: AnalogIn_Record_Trigger.py

Link to comment
Share on other sites

@attila

Thanks for helping. I think I'm still a little confused about the alignment. I feel like this isn't even that complicated, but I just can't grasp it. Below is two examples of results I've gotten from messing with TriggerPosition. I have turned AutoTimeout to 0 and that has seemed to help the reliability of my program.

triggerdelay.thumb.PNG.c338d40ff51a88a90416a2d9015a6cf4.PNG

This is RecordLength = 50ms and Trigger Position = 10ms. +/- trigger position yields the same results

trigger0_03.thumb.PNG.f23af48fca63da57954e8ae526c91df3.PNG

This is RecordLength = 50ms and Trigger Position = 30 ms. +/- once again makes no difference. 

5ad0f91e3e45d_triggernodelay.thumb.PNG.d524d9e5b891a514fcc0171c212cfa84.PNG

This is RecordLength = 50ms and TriggerPosition = 0. 

I just want this waveform to fill up the entire buffer while being sure that no data is lost

recordlength0_06.thumb.PNG.fad1a060f511bd7c24c85585db7abda8.PNG

This is RecordLength = 60ms and TriggerPosition = 0. I'm not sure if this helps at all, I'm just trying to provide a lot of data. I'm really struggling with this.

Link to comment
Share on other sites

Hi @TurgidWater45

Here the trigger position is set to 20%, -1 sec for a 5 seconds record.
The trigger was detected at X1 and the record is continued for 4 more seconds, to X2.
image.png.d35d39abffec0475d3e5bdb8138222dd.png

The data needs to be aligned, shifted to last recorded sample, X2 to become the last sample in the record buffer:
image.png.c697cc7f14cb23a7e2e50e32e654721e.png

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...