10-19-2010 12:11 AM
Hi all,
I have had much luck with these forums in the last week since my introduction to LabVIEW, but have been stuck on this simple procedure for a few days. I have created a subvi to set an external pump's frequency. The aim is to input an array of frequencies and then for each frequency, set the pump to that frequency, wait a duration <t_transition> until the flow is steady, then record data from the DAQ Assistant to a Measurement File which has a filename path generated based on the current frequency and record the data for a certain time period <t_rec>. Once the recording is finished it should go to the next frequency and begin the loop again.
My problem seems to be implementing the wait duration and recording period in the For loop, as well as ensuring it is sequential. If I use a sequence structure, the DAQ which is outside the sequence structure pauses as it does not allow parallel execution. If I remove the sequence structure, I do not know how to make it pause before recording, and stay at the current loop increment until recording is finished.
10-19-2010 12:49 AM
Include the DAQ inside the loop, and ignore the data acquired by DAQ during 'Transition period', and use the data from DAQ only when you need it.
For your timer implementation, refer to the attached code.
10-19-2010 12:56 AM
@moderator1983 wrote:
Include the DAQ inside the loop, and ignore the data acquired by DAQ during 'Transition period', and use the data from DAQ only when you need it.
For your timer implementation, refer to the attached code.
Cool, I'll try that now. Ideally, however, I would want to see what the incoming data looks like even when it's not recording. I can't do this if it's in the loop, correct?
Also, I am using LabVIEW 8.5, so your attached VI wouldn't open. Can you save for previous version? Thanks!
10-19-2010 01:00 AM
yeah you can see the signal, for that you need to keep the waveform graph inside the loop as well.
10-19-2010 02:27 AM
Excellent... It's sort of nearly working.
- One issue I have is that when I am not taking data (I have a case structure that 'starts' the looping), the DAQ doesn't provide an output. It seems paused while the for loop is running.
10-19-2010 07:30 AM
Not related to your question, but you overuse local variables. You should use wires instead if possible.
To your DAQmx question, if you do use the DAQmx functions (there is a DAQmx palette) instead of the express vi (DAQ assistant), you have the options to start and stop tasks.
Felix
10-19-2010 02:17 PM
The reason that you are seeing the "pause" during the for loop is because the DAQ Assistant will only run once per iteration of your main while loop. It looks like your for loop takes much longer to run than your DAQ Assistant therefore giving the appearance of a pause. I do agree that you should use the DAQmx functions to give you more control. You can refer to the NI Example Finder under Help in LabVIEW and look under Hardware Input and Output>>DAQmx.
Brandon Treece
Applications Engineer
National Instruments
10-19-2010 06:53 PM
@f. Schubert wrote:
Not related to your question, but you overuse local variables. You should use wires instead if possible.
To your DAQmx question, if you do use the DAQmx functions (there is a DAQmx palette) instead of the express vi (DAQ assistant), you have the options to start and stop tasks.
Felix
Thanks, once the basics work, I'll clean it up and get some reading done. Once this is automated, I'll have time to study it!
As for the DAQmx functions, I haven't looked into that. I'll give that go now.