Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with DAQmxCreateAIFreqVoltageChan

I have a 6008-USB card and NI-DAQmx 7.5.

Every 10 seconds, I have to measure frequency of a pulse train (from
3000 to 4000 Hz, TTL level).

I wrote the following code, but when I compile and run it (MS VC++ 6.0)
I always got this output:

Frequency is:
-92559631349317831000000000000000000000000000000000000000000000.000000

Where I am mistaking??

Here is the code:

/************/


float64 f; /* frequency */

DAQmxCreateTask("Frequency",&taskHandle);

DAQmxCreateAIFreqVoltageChan(taskHandle,
"Dev1/ai0",
"",
3000,
4000,
DAQmx_Val_Hz,
0.0,
0.2,
"");

DAQmxStartTask(taskHandle);

while( !_kbhit() ) { /* hit any key to exit */

Sleep(10000);

DAQmxReadAnalogScalarF64(
taskHandle,
10,
&f,
0);
printf ("\rFrequency is: %f Hz", f);
}
0 Kudos
Message 1 of 2
(3,358 Views)

Rossi,

The USB-6008 does not support frequency measurements in hardware. The 6008 can only do simple even counting. So you can set it up in software to measure frequency, but only at low frequencies ( <50Hz or so). Here is a KB describing this if you would like some more information. It also describes how you can set up the software frequency measurement. I hope that has been helpful.

-GDE

0 Kudos
Message 2 of 2
(3,354 Views)