09-15-2009 09:54 PM
Hello,
I am trying to develope a vi in which will access a daq board and acquire 0.5 seconds of voltage data from specific inputs on the board. The below posted vi will continously sample after start is pressed and write the data to a file. I want to modify this code to fit inside another vi so when accessed it will record the data for each step in the "outer" vi. Any assistance would be greatly appreciated.
Brian
09-15-2009 10:11 PM
The VI you have posted is setup to be a top level VI because of its while loop with a front panel stop button. How many "steps" do you want to acquire? You really don't need a subVI. You should set up your main VI to create the DAQ task before and sample clock before the loop like you do now. Replace the While Loop with a For Loop with your "# of steps" wired to the N terminal. Inside the loop, acquire the number of samples that is equivalent to a 1/2 second of your data rate. So for a 1 kHz sample rate, acquire 500 samples. After the For Loop, clear the task like you are doing now.
09-15-2009 10:31 PM
My problem is the "acquire samples" part inside the loop. When I wire my # of samples to N, I don't know where to wire the N within the for loop. As you alluded to, I would like this to be a "background" vi in the sense that it will just run when propmted by another vi. Thanks again,
Brian
09-15-2009 10:36 PM
Are you sure you even want a For Loop?
If you want this to be a subVI, you can't have any kind of loop inside of it. If you want precisely 1/2 seconds worth of data, you will have to change the 4096 constant to whatever makes sense for your data rate.
Exactly what are the "steps" you are talking about for the top most VI? Perhaps you can give a little more description of your application so that instead of just answering your question (which I have a feeling isn't going to solve your problem) we can suggest a solution that will do what you want it to do.
09-15-2009 10:43 PM