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.