ni.com is currently undergoing scheduled maintenance.
Some services may be unavailable at this time. Please contact us for help or try again later.
01-16-2011 01:30 AM
I want to use the example in NI help forcontinuous data acquisition( C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage\Cont Acq-Int Clk)
,but when I use the function “int32 CVICALLBACK EveryNCallback”,the program didnt seem to work,i wonder if there some problem that i use that function in MFC ,next is my program
#include "stdafx.h"#include "zhanglei.h"#include "zhangleiDlg.h"#include "NIDAQmx.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif#include <stdio.h>
#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else
int32 CVICALLBACK EveryNCallback(TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData);int32 CVICALLBACK DoneCallback(TaskHandle taskHandle, int32 status, void*callbackData);
01-17-2011 02:45 AM
what error shows up when running your code? Could you help post your error screenshot here?
01-17-2011 02:54 AM
Then you may interested in below thread(showing the multi-thread callback function):
http://digital.ni.com/public.nsf/allkb/B099001BEEFF41F0482571DA002E2C36
01-17-2011 10:31 PM
many thanks for attention
the problem is that there is no error ,my program can run without any problem but the point is it cant acquise any
data. i just wonder if i didnt write the call back function in a right way.and can you give some example of how to use the callback fuction in MFC.
thank you again for your kindness.
01-17-2011 10:50 PM
LiYi:
thank you
I attach my simple demo as a attenment.,and thank you for pay attention on it.
01-19-2011 11:53 PM
Since this is the example shipped with the DAQmx driver, I think there will no problem with this code.
I suggest you debug step by step to see what happens. After reviewing your code in the main function, I did not found any errors.
Also please note that don't put any code in the Every N Samples function to suspend it -- Just read the data out.
01-20-2011 07:37 PM