12-15-2011 04:28 PM
Using LabWindows/CVI, I have a program that sets up a NiDAQmx task (configured via MAX) in one dll and can then start that task (via the DAQ call) from one of two panels. The task is set up to gather N samples from a trigger, and when all N samples (1000, in this case) are gathered a call-back routine is called to handle the data. When I start the task from one panel, the data acquisition works perfectly; when I start from the other, the data handler routine is never called, although there are no errors or warnings. Both places end up calling the exact same routines to start and stop the DAQ task.
The only difference that I can see is that the first panel calls the DAQ-start routine from the panel control callback (called when the START button is pushed) and immediately exits the callback routine. In the second panel I would like to do a certain amount of processing after the data is acquired, so the callback routine calls a "Start Acquisition" routine which starts the DAQ task and then goes into a loop waiting for the data to be acquired - which it never is, of course, since the data handler callback is never called by the NiDAQmx task.
Could the fact that the second routine never exits from the button callback routine be messing up the NiDAQmx task?
Solved! Go to Solution.
12-16-2011 01:58 PM
Hi pblase,
I found a somewhat similar situation discussed in this thread: http://forums.ni.com/t5/LabWindows-CVI/Processing-different-pending-events-in-a-DAQ-callback/td-p/10.... It appears that being in that callback routine may be blocking your DAQmx Task callback from being triggered. If you goal is just to wait until the post processing has been done, you may be able to set up a flag to enable waiting and return from the callback routine so that you can wait for the task to finish in the main program.
12-16-2011 03:41 PM
Yes. If I rigged my routine so that it returned immediately, the data was acquired properly. Apparently the DAQmx data handler routines are serviced in the normal windows loop. Now I just have to figure out how to call the post-processing routine.
12-17-2011 12:09 AM
Since you are performing a finite acquisition, DAQmxRegisterDoneEventfunction can be of help: the installed callback will be called after the acquisition is completed so you can perform your data processing in that function.