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

Buffered gated event counting

$
0
0

Dear all,

 

I'm trying to add gating to buffered event counting. The latter works, however, making it gated gives errors. Since turning the counter on and off seems simple enough, I hope I'm missing something. Gating would be in the order of microseconds, while sampling is in the order of milliseconds.

 

Below the example I tried, which gives the error: Pause trigger is only valid for event counting if sample clock is not used.

 

TaskHandle task_out;
DAQmxCreateTask( "", &task_out );
DAQmxCreateCOPulseChanFreq( task_out, "dev1/ctr3", "", DAQmx_Val_Hz, DAQmx_Val_Low, 0, 20.0, 0.5 );
DAQmxCfgImplicitTiming( task_out, DAQmx_Val_ContSamps, 2 );
DAQmxStartTask( task_out );

 

TaskHandle task_in;
DAQmxCreateTask( "", &task_in );
DAQmxCreateCICountEdgesChan( task_in, "dev1/ctr1", "", DAQmx_Val_Rising, 0, DAQmx_Val_CountUp );

 

DAQmxSetPauseTrigType( task_in, DAQmx_Val_DigLvl );

DAQmxSetDigLvlPauseTrigSrc( task_in, "dev1/ctr1" );

DAQmxSetDigLvlPauseTrigWhen( task_in, DAQmx_Val_Low );

 

DAQmxCfgSampClkTiming( task_in, "/dev1/ctr3InternalOutput", 20.0, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 2 );

 

DAQmxStartTask( task_in );

// Reading

DAQmxStopTask( task_in );

DAQmxStopTask( task_out );

 

Does anyone know whether there is a different way to do this, or would I have to put a switch at the input of the counted signal?

 

Kind regards

 

(Using PCI 6601, windows 7, version 17.0.0 for NIDAQmx, c++)

 

PS One post seemed to ask something similar (post title being 'Buffered gated event counting'), but for the application in that post, buffered gated event counting was not required and a different kind of measurement was proposed.


Viewing all articles
Browse latest Browse all 1250

Trending Articles



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