LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

NiDAQmx DAQ-start from panel button push

Solved!
Go to solution

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?

0 Kudos
Message 1 of 4
(2,857 Views)
Solution
Accepted by topic author pblase

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.

Justin D
Applications Engineer
National Instruments
http://www.ni.com/support/
0 Kudos
Message 2 of 4
(2,845 Views)

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.

0 Kudos
Message 3 of 4
(2,842 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 4
(2,835 Views)