Dynamic Signal Acquisition

cancel
Showing results for 
Search instead for 
Did you mean: 

9401 timeout when using c api

Hello everybody,

 

I want to measure a frequency using the c api.

 

So I took the C example "DigFreq-LowFreq1Ctr.c" and ran it.

The interesing lines are:

DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateCIFreqChan(taskHandle,"Dev1/ctr0","",1.192093,10000000.000000,DAQmx_Val_Hz,DAQmx_Val_Rising,DAQmx_Val_LowFreq1Ctr,0.001,4,""));

DAQmxErrChk (DAQmxStartTask(taskHandle));

DAQmxErrChk (DAQmxReadCounterScalarF64(taskHandle,10.0,&data[0],0));

 

I always get a timeout when trying to acquire the frequency value:

 

-200474. Specified operation did not complete, because the specified timeout expired.

 

I'm using a NI 9401 on slot 4 of a cDAQ-9174 (4 slot USB compact DAQ).

 

The example to count edges works fine for me so I'm wondering what I'm doing wrong.

 

Do I have to route a clock source to the counter first or did I forget something else here?

 

Thank you in advance.

 

 

King regards,

 

Fred

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

Hi Fred,

 

please have a look at this Knowledge Base:

http://digital.ni.com/public.nsf/allkb/4E017925BDF2DC2D862572E6007C9594

 

Any input frequency below 100Hz yields error -200474, so you have to delete this error programmatically.

The introduced approach in LabVIEW can also be implemented in C.

 

Best regards

Christian

 

Christian
CLA, CTA, CLED
0 Kudos
Message 2 of 2
(5,572 Views)