09-11-2008 08:42 PM
How do I define the Call back function from the RegisterEveryNSamplesEvent as a data memebr of a class so I don't get compile errors in Visual C++ (2005) MDI- MFC..... The function has a prototype like this: int32 CVICALLBACK Callback (TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData); .......... I can declare it on top of .CPP file as a static function sort of the NI sample examples, but then, I would have no access to the data members of the class like Buffers, chs...etc.... There must be something I am missing, how are we supposed to process the data and pass data back and forth from and to this Call back function where we are supposed to read the data from the NI buffers since Buffers are ready to be read...............
Can someone please clarify this to me?
Thanks
09-14-2008 04:35 PM
Hi,
Do you have Measurement Studio on your machine as well as DAQmx? If you do, a great place for you to get started would be with the shipping examples that are located at <NI-DAQ>\Examples\MStudioVC2003 or MStudioVC2005 . These are the MFC DAQmx examples.
Examples of how to register for callbacks like the RegisterEveryNSamplesEvent are located in the DAQmx ANSIC directory at <NI-DAQ>\Examples\DAQmx ANSI C which install with DAQmx. I am unsure if this is the approach you want to take however, as the method for registering for callbacks in C may not be applicable in MFC C++.
09-15-2008 03:39 PM
Hi,
if its not the way to go, and I am having hard time getting in to work in MFC, what is the way to go...All I need is something to tell me Buffer is complete and ready to be read. I would have thought moving from traditional to NIDAQmx will make things easier, not more complicated, and they would have kept a flag or something like that.
09-17-2008 02:04 PM