Quantcast
Channel: Counter/Timer topics
Viewing all articles
Browse latest Browse all 1271

Counter output, on demand

$
0
0

I'd like to have a counter output a single pulse whenever a condition occurs within a loop. My current solution (in pseudocode; I use LabWindows CVI on a RT target) looks like this:

 

DAQmxCreateTask(...);
DAQmxCreateCOPulseChanTime(...);
while (true)
{
  if (condition)
  {
    t1 = Timer();
    DAQmxStartTask(...);
    t2 = Timer() ;
    DAQmxErrChk (DAQmxWaitUntilTaskDone(*th,2));
    DAQmxErrChk (DAQmxStopTask(*th));
  }
}
DAQmxClearTask(...);

Unfortunately, the delay between t1 and t2 is at least 0.142ms, and sometimes 2ms. Is there an elegant way to decrease this and not having to call StartTask again and again?

 

Thanks,

Jonas 


Viewing all articles
Browse latest Browse all 1271

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>