03-06-2009 03:45 PM
I am trying to evoke EveryNCallback every 400*6(channels) data in analog channels. But the codes below do not access the callback function.
After I run it, no errors, but
The thread 'Win32 Thread' (0xf3c) has exited with code 2 (0x2).
The thread 'Win32 Thread' (0xae4) has exited with code 2 (0x2).
DAQmxErrChk (DAQmxCreateTask("",&datHandler));
DAQmxErrChk (DAQmxCreateAIVoltageChan(datHandler,"Dev1/ai0:5","",DAQmx_Val_Cfg_Default,-5.0,5.0,DAQmx_Val_Volts,NULL));DAQmxErrChk (DAQmxCfgSampClkTiming(datHandler,
"",4000,DAQmx_Val_Rising,DAQmx_Val_ContSamps,400));DAQmxErrChk (DAQmxRegisterEveryNSamplesEvent(datHandler,DAQmx_Val_Acquired_Into_Buffer,400,0,EveryNCallback,NULL));
DAQmxErrChk (DAQmxStartTask(datHandler));
ERROR: ...
int32 CVICALLBACK EveryNCallback(TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData)
{
int32 error=0;int32 read;
float64 data[400*numLaser];
DAQmxErrChk (DAQmxReadAnalogF64(datHandler,-1,10.0,DAQmx_Val_GroupByChannel,data,400*NUM,&read,NULL);
myControlTable.cfile.Write(data,sizeof(float64)*400*numLaser);
ERROR: ...
}
Please help
03-09-2009 10:51 AM
Hi Iwu,
It's difficult to say what may be causing this error as this is not a DAQmx error. How are you verifying that the code is not accessing the callback function? Could we try running one of our DAQmx shipping example to see if you can at least get that working. The example I would like you to run should be found under the following directory:
C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage\Cont Acq-Int Clk
If this example works, could we try modifying this code to for 6 channels and configure a callback after every 400 samples on each channel?
Also could you tell me what hardware you are using?