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");return0;}FDwfAnalogInFrequencySet(hdwf,100000.0);FDwfAnalogInBufferSizeSet(hdwf, bufferSize);FDwfAnalogInChannelEnableSet(hdwf,0,true);FDwfAnalogInChannelRangeSet(hdwf,0,4.99);// disable auto triggerFDwfAnalogInTriggerAutoTimeoutSet(hdwf,0);// one of the analog in channelsFDwfAnalogInTriggerSourceSet(hdwf, trigsrcExternal1);FDwfAnalogInTriggerTypeSet(hdwf, trigtypeEdge);FDwfAnalogInTriggerChannelSet(hdwf,1);FDwfAnalogInTriggerLevelSet(hdwf,1.5);FDwfAnalogInTriggerConditionSet(hdwf, trigcondRisingPositive);// wait for the offset to stabilizeWait(2);
printf("Starting repeated acquisitions:\n");int iTrigger;for(iTrigger =0; iTrigger <200; iTrigger++){// begin acquisitionFDwfAnalogInConfigure(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.
Question
Daniel Rech
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:
Compile it with
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
Link to comment
Share on other sites
7 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.