LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RT, DAQ, storing previous samples


I have two while loop. In tre first loop i do sampling and write sample as double to a buffer. (at each iteration, i add one sample) In the second loop i do tone measurement to measure frequency of the signal by using sample taken from buffer filled in the first loop.To measure frequency i need more
 than one sample(Say 20 sample) Period of first loop is 1 mse and second is 20 msec. In first loop i fill buffer at 20 msec and second loop read all sample it the buffer and calculate frequency. With this configuration i can maseure correct frequency values. But i want to decrease this 20 msec. In order to do this, i want to input also previous sample
to "tone measurement vi" in the second loop.
For example the first loop run again at 1 msec. But the second loop run at 10 msec. "tone measurement vi" reads the most 10 sample which first loop writes as well as the previous 10 sample. (total 20 sample) .How can store previos samples?. When i try to use buffer, in second loop, tone measuerment vi read all sample and the buffer be cleaned.
0 Kudos
Message 1 of 3
(3,087 Views)

Hi,

If you would like to store previous iterations of a while loop, simply replace a tunnel with shift registers.  A shift register is used to store multiple iterations of a while loop.  I have attached a link to the LabVIEW help regarding shift registers.  I would not only use a shift register, but also a preallocated array that will be indexed to the correct index to store the previous iteration of the loop.

I hope this helps!

Regards,

Nadim
Applications Engineering
National Instruments

 
0 Kudos
Message 2 of 3
(3,075 Views)
Before i read your reply i used another way. I used 1 element (array type) queue to store previous sample data. But to use shift register seems to be better.
Thanks for help
0 Kudos
Message 3 of 3
(3,060 Views)