Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx Counter Input Measure a single pulse's pulse width

Trying to measure a single pulse's pulse width. It appears that the DAQ only makes the measurement on the read command instead of after starting the task. I just get a timeout error. Is there any way to arm to counter for measurement or am I better off making a seperate thread to trigger my single pulse?

 

double measured;

int numSamp;

TaskHandle taskHandle;

 

DAQmxCreateTask("", &taskHandle);

DAQmxCreateCIPulseWidthChan(taskHandle, "Dev1/ctr0", "", 0.025, 0.120, DAQmx_Val_Seconds, DAQmx_Val_Rising, "");

DAQmxSetChanAttribute(taskHandle, "", DAQmx_CI_PulseWidth_Term, "/Dev1/PFI10");

DAQmxStartTask(taskHandle);

//Trigger the single pulse here

DAQmxReadCounterF64(taskHandle, DAQmx_Val_Auto, 10.0, &measured, 1, &numSamp, NULL);

 

Thanks,

Dan

0 Kudos
Message 1 of 2
(5,684 Views)

Which device are you using?

 

If you configure implicit timing (DAQmxCfgImplicitTiming) your measurements will be buffered and will begin when the task is started.  The minimum buffer size is usually (always?) 2 samples, but that doesn't mean you have to read two samples back.  

 

 

Best Regards,

John Passiak
Message 2 of 2
(5,679 Views)