Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ ANSI C callback function

I am trying to read data from NIhardware using NIdaqmx.h & lib files.
Code is in Vc++2005 .
I am able to read data when it is configured for Finite samples, but when configured for continuos ,call back function is not getting called.
I am using "C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage\Cont Acq-Int Clk" example.
Output of DAQmxRegisterEveryNSamplesEvent function is zero which indicates success.
I have breakpoint in call back function & after registering call back function my program is not going to that breakpoint.
 
Callback is registered as DAQmxRegisterEveryNSamplesEvent(taskHandle,DAQmx_Val_Acquired_Into_Buffer,1000,0,EveryNCallback,NULL);
 
Please if some one can help me solving this problem.
 
Regards,
 
Minal
0 Kudos
Message 1 of 4
(7,743 Views)

Hi Minal,

Do you get any sort of error message?  Or does DAQmx just never return any samples but also never give an error code?

You could try creating a simulated device and see if the same problem occurs with the simulated device.  What device are you using?

Also, one other question for you -- have you modified the example code at all or is it just the original example?

0 Kudos
Message 2 of 4
(7,724 Views)
Dear Minal,

I experienced a similar issue using C++ VisualStudio .NET: The callback function registered by DAQmxRegisterEveryNSamplesEvent was only called when the sampleMode parameter in DAQmxCfgSampClkTiming was set to DAQmx_Val_FiniteSamps, but not for DAQmx_Val_ContSamps.

I eventually tracked the issue down to the sampsPerChanToAcquire parameter in DAQmxCfgSampClkTiming: The callback is only called for values below 10000.

Since you have sampsPerChanToAcquire = 1000 in your code, this may not be relevant to your problem, but I recommend starting from National Instruments' ContAcq-IntClk.c example and changing parameters one at a time to find the issue.

Good luck!
Philip

0 Kudos
Message 3 of 4
(7,702 Views)

Hey thanks guys.

By upgrading the version to DAQ8.5 my problem was solved.

Minal

 

0 Kudos
Message 4 of 4
(7,689 Views)