‎06-02-2009 06:11 AM
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 ?
‎06-03-2009 05:04 AM
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
‎06-03-2009 08:25 AM
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
‎06-04-2009 09:18 AM
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