LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Programm don't react to UserEvents(?)

Hy everyone,

I've got a little problem.

I have a GUI including a stripchart and a start-, stop- and quit-button. My programm writes data to the PXI-4461 an acquires data continously with the PXI-4462. I'm using the DAQmxRegisterEveryNSamplesEvent() with creating a new thread for the called function.
When the user click the start-button, the programm initialize the hole system and starts writing data to the PXI buffer.
The DAQmxRegisterEveryNSampleEvent calls every 0.2s the function in the second thread. So that the user doesn't have a chance to click the stop-button. (because I'm printing continously data to/ on the StdioPort?)

I like the user to have the possibility to stop acquiring data at any time he/ she like to. (So I need to change the focus from the StdioPort to the GUI?)

And then, when the user click the stop-button, the system should wait for the second thread to complete and quit the GUI.
I tried to use ProcessSystemEvents, ProcessDrawEvents and CmtWaitForThreadPollFunctionToComplete. But it still doesn't work properly and I don't really know where to call ProcessSystemEvents. And with the thread I've got the problem, that the thread isn't in the DEFAULT_THREAD_POLL (I think) and I don't know how to get the PoolHandle.

Do you know anything?

Thanks for help, Heike
0 Kudos
Message 1 of 2
(3,046 Views)
It doesn't sound like you having a application issue with CVI but rather you're looking for how to conceptually accomplish some goal.
 
Is the GUI not responsive to user events? Seems like 200ms (.2 seconds) should give you plenty of time to run a callbackfunction. Just a simple solution but perhaps settings a global variable TRUE or FALSE then checking this value in your acquisition thread in order to stop acquiring would accomplish your goal. Try looking into Thread Safe Variables as well.
 
Craig
0 Kudos
Message 2 of 2
(3,026 Views)