Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

loop while gone mad

Solved!
Go to solution

i am using lab view and while loop in itthe loop while stops execution after ten minutes saying that computer is out of virtual memoryi need the while loop to run untilll i stop ithelp me in this

0 Kudos
Message 1 of 3
(3,513 Views)
Solution
Accepted by topic author data logging

@data logging wrote:

i am using lab view and while loop in itthe loop while stops execution after ten minutes saying that computer is out of virtual memoryi need the while loop to run untilll i stop ithelp me in this


Hello data logging,

 

I tried out your VI and I received the same error. This error is occuring because the data being measured is allocated into an array of a fixed size; so although there is plenty of memory left in the computer, only a set amount has been allocated for this block. The giveaway was that the points in the graph came closer and closer together as the while loop iterated, rather than the graph only showing a fixed set of points and then having the older data pass away off screen; this means you're graphing a very large amount of data. I believe this is happening because you are sampling the entire buffer of read data from AI at a rate of 1Hz. As you did not specify the number of samples to be read, LabVIEW defaulted this to 1000, leaving your program to read 1000 samples at 1Hz and constantly put this data onto the graph. This means that every time you iterate, you read the entire buffer of data as it becomes slightly bigger, until there are two many points for the graph to cope with causing a virtual memory error.

 

You should always choose a sample mechanism which ensures that you're sampling at least twice the maximum frequency you wish to sample; usually sampling 10x higher than the maximum frequency in real world applications, this is called Nyquist's Theorem. In terms of reading the samples, if you only wanted to read the samples once every second you could implement a wait in your While Loop of 1s, or you could set the number of samples to read to be equal to the buffer size, therefore number of samples per second would be the number of samples read per second, giving you a 1Hz sampling update. I've implemented this change in your code below:

 

MemorySampling.png

 

 

Here's a much easier implementation of reading data at a high speed from AI0; double click on the DAQ Assistant Express VI from the Express Pallette to change which channel you wish to read from. The difference here is that the buffered data will be emptied on each read. This will also give you a detailed update (1000 Samples) at a 1Hz interval. If you want to update once a second with only one value, set the number of samples and rate both to 1; this won't cause a memory error.

 

 

DAQ1.png


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

Message 2 of 3
(3,475 Views)

Alex T. 

great job

thanks

done

 

0 Kudos
Message 3 of 3
(3,422 Views)