01-24-2008 10:15 AM
01-24-2008 05:42 PM
01-24-2008 11:59 PM
01-25-2008 07:14 AM
01-25-2008 07:29 AM - edited 01-25-2008 07:32 AM
01-25-2008 07:39 AM
01-25-2008 07:54 AM
It's quite clear now why your acquisition is stopped while you are running the start button callback: you are not allowing inside your loop the execution of other parts of the code (like on the contrary you are allowing inside the loop in the main function by using ProcessSystemEvents function).
Given this, I personally discourage you from having two concurrent loops each of them with a ProcessSystemEvents inside: this could lead to a totally unpredictable behaviour of your system. I suggest you instead to modify your application structure in such a way that:
1. You have a DAQmx task that continuously acquires measures from the field and periodically fires a callback by using DAQmxRegisterEveryNSamplesEvent. Inside that callback you can read your measures and accumulate them on disk avoiding the overhead of starting and stopping the task at each iteration. The task need to be stopped when the program exits (or upon user request or in some other way during your program life)
2. After launching your task you issue the ProcessSystemEvents that starts all user interface events handling
3. You have a start button that simply starts a new thread and exits immediately. In the separate thread you can handle your test procedures. Alternatively, the start button can enable a timer control (or an asyncronous timer) if you can structure your loop in a way that can be handled with a timer, a state machine or something similar.
Item 1 could be embedded into the callback in item 3 if your acquisition need to be active only while the test is running and not during all program life.
01-25-2008 10:29 AM
01-25-2008 03:45 PM
01-28-2008 10:15 AM