Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

NI9239 DAQmxRegisterEveryNSamplesEvent callback never occurs

Hi,

Using the compactDAQ cards with callback, on a console application it works fine. In a windows dialog (MFC) however, although everything up to 'start task' work fine, the callback routine is never called.

e.g.

DAQmxErrChk (DAQmxResetDevice("cDAQ1Mod1"));

DAQmxErrChk (DAQmxCreateTask("",&taskHandle));

DAQmxErrChk (DAQmxStopTask(taskHandle));

DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle,"cDAQ1Mod1/ai0","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Volts,NULL));

DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",1000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));

DAQmxErrChk (DAQmxRegisterEveryNSamplesEvent(taskHandle,DAQmx_Val_Acquired_Into_Buffer,1000,0,EveryNCallback,NULL));

DAQmxErrChk (DAQmxRegisterDoneEvent(taskHandle,0,DoneCallback,NULL));

DAQmxErrChk (DAQmxStartTask(taskHandle));

------

 

int32 CVICALLBACK EveryNCallback(TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData)

{

     etc - never called

 

------------Any thoughts please ?

 

0 Kudos
Message 1 of 4
(3,339 Views)

Hi Neil,

 

 

I would be interested to know a little more about your code.  What environment are you programming in?  What driver versions are you using? What OS are you running?

 

Any other information that would allow me to understand more about your application would be appreciated.

 

Regards,

 

Thomas Clark

Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 2 of 4
(3,325 Views)

Hi,

I am using NIDAQ8.8; environment Windows 2000 SP4 or XP SP latest; MFC code in Visual C++.net 1.1.4322 SP1.

Hardware is newly bought 9239's in a cDAQ9172 chassis; (PC is Asus 3GHz dual core).

 

I noted, while messing about, that if I added 'n' blocking reads (DAQmxReadBinaryI32)after the ADC start, that then 'n' calls were made to the callback routine.  With no silly extra reads, then the callback code was never called.

 

Thanks,

                  Neil

0 Kudos
Message 3 of 4
(3,321 Views)

Hi Neil,

 

 

I still have a few more questions regarding your application. How was your working code compiled?  Was this written in CVI and then taken over to Visual C++? 

 

 

Regards,

 

 

Tom

Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 4 of 4
(3,305 Views)