01-05-2012 01:43 PM
Ellen,
What data are you trying to read in relationship to menu item selections? Depending on the answer to this, there may be on or more approaches we can take. However, with any of these approaches it is important that we don't clear the task until we're done with our application. In terms of what data you'd like read ('Take DATA' case), I could see this being one of two things.
1) Most recently acquired 'Data Samples to Read' data
2) The next 'Data Samples to Read' data acquired by the device.
If you are interested in 1, then configuring DAQmx as a continuous task as you have done is a reasonable approach. You'll want to start the task outside of the main loop as you are already doing. Since you want to read already acquired data, you can specify to DAQmx to read at an offset of -1 *'Data Samples to Read' from the most recently acquired sample. This is done via the DAQmx Read Property Node (RelativeTo and Offset properties).
If you are interested in 2, then it makes more sense to me to configure the DAQmx Task to be finite, and specify number of samples as necessary in the DAQmx Timing VI. In this case you would explicitly commit the task before your main loop (DAQmx Control Task.vi). In your read case, you would then Start, Read, and Stop the task.
For both of these cases, you would not clear your task until after the main loop was complete.
If you can provide me a better description of what you need need to read (and when) I may have some time to whip up an example.
Hope that helps,
Dan