LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Looping with DAQ recording to different files and sleeping in the loop.

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.

 

 

 

 

0 Kudos
Message 1 of 8
(3,085 Views)

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.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


Message 2 of 8
(3,079 Views)

 


@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!

 

 

0 Kudos
Message 3 of 8
(3,077 Views)

yeah you can see the signal, for that you need to keep the waveform graph inside the loop as well.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


Message 4 of 8
(3,074 Views)

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.

 

 

0 Kudos
Message 5 of 8
(3,065 Views)

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

Message 6 of 8
(3,046 Views)

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

0 Kudos
Message 7 of 8
(3,028 Views)

 


@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. 

0 Kudos
Message 8 of 8
(3,016 Views)