LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Output data in a While Loop

Maybe I am asking a basic question but I've been working with this all day and I don't know what to do.

 

I am using two while loops with a DAQ assistant inside of each one to read points from my hardware. Mainly temperatures and voltages...

 

I want to keep record of that data, as well as plotting it in the screen, and using it to make a control loop. Like a thermostat.

 

I don't know how can I export the data properly outside of the While Loop. Using the tunnel only gives the last measurement at the end of the while loop.

 

0 Kudos
Message 1 of 6
(3,289 Views)

I cant open the VI because I only have labview 8.5, but have you enabled indexing on the tunnel? (Right Click and select Enable Indexing)

0 Kudos
Message 2 of 6
(3,278 Views)

I can't see your code because it's 13.

Anyway there are two options.

1. you don't output an arrray but a constant

2. you have your tunnel mode wrong

 

Koen

---

UnCertified LabVIEW Student
Mistakes are for learning, that's why suggestions are always welcome!
0 Kudos
Message 3 of 6
(3,275 Views)

@Marcus90 wrote:

 

I am using two while loops with a DAQ assistant inside of each one to read points from my hardware. Mainly temperatures and voltages...

 


I can't open your VI but here are some quick questions.  Why are you using two separate while loops?  Do your measurements have to be taken at different rates?Do you have more than 1 piece of hardware? (if not you should be using a single DAQ assistant).  

 


@Marcus90 wrote:

 

I don't know how can I export the data properly outside of the While Loop. Using the tunnel only gives the last measurement at the end of the while loop.

 


The tunnel is just that, it passes through what you wire to it (in your case they are likely constants).  Use a shift register to keep track of an array between iterations.  During each iteration, insert the newly measured values into the array.

0 Kudos
Message 4 of 6
(3,235 Views)

Hi Marcus90

 

The most efficient way to acquire data is to use DAQmx API. Here some links that might help you for your application:

 

https://www.ni.com/en/support/documentation/supplemental/06/learn-10-functions-in-ni-daqmx-and-handl...

 

https://www.ni.com/en/support/documentation/supplemental/06/getting-started-with-ni-daqmx--main-page...

 

In your specific case, you also can have a look to “synchronization” on our website www.ni.com or check this webcast about Timing and Synchronization:

 

https://www.ni.com/en/support/documentation/supplemental/06/timing-and-synchronization-features-of-n...

 

Finally, we provide at NI a course called “Data Acquisition and Signal Conditioning Course” that you can follow, which provide you most of the information about DAQ.

 

Hope these information will help you.

 

Have a good day

 

Certified LabVIEW Architect (CLA)
0 Kudos
Message 5 of 6
(3,189 Views)

Marcus90,

 

Looking briefly at your code, you have more basic problems here than have been addressed above.

 

You have three loops which all have no delay timing within , so they will all try to proceed at maximum speed (especially the right-hand one, the others may use some timing inside the DAQAssistant, I don't know), so your computer will get bogged down and unresponsive. They also are set to run forever (or until you have to reboot the computer), so ther'e's no way to stop the program except for hitting the abort button (the stop sign in the menu bar), which may not work until the umpteenth time you click on it, if at all, because the loops are hogging all the computer time (this is not a good way to stop things, anyway).

 

If you want to plot graphs which are supposed to be synchronized, you need to have the data acquisition synchronized, which you have not done here.

 

I would suggest that you do three things, in this order:

 

1.  Work through at least the free online tutorials you can find on LabVIEW (a couple of the more popular ones are listed at the end of this post - if you do go through them, please let me know how helpful they were) to give you a start on the fundamentals of the language - what to do and what not to do.

 

2.  Work with each instrumental input singly until you can take data and plot it inside the same loop. Then take the DAQAssistant out and use the fundamental DAQ functions so you have real control over your instrument (the DAQAssistants are good for getting something out of your instrument, but IMHO they take away too much control from you in order to get an instrument running "quick and dirty").

 

3.  Assemble a combined VI from your working VIs now that you know they are each functional and your only task is to coordinate them to your graphs/charts, quite possibly within the same loop. Remember the KISS principle.

 

Then you can work on using the data to build a control loop.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 6 of 6
(3,170 Views)