10-11-2013 12:54 PM
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
10-11-2013 04:42 PM
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,