LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help: writing three waveforms to spreadsheet file for a set amount of time

Hi all,

 

     I am having trouble writing three waveforms to a spread sheet file for a set amount of time.  I have attached the VI in question.  I am using three sine waves as my waveforms and running a while loop to save the amplitude of each waveform as a column in a spreadsheet file until the elapsed time end condition is met.  My problem is that I seem to be generating more data than I think I should be.  For example, if you run the VI for a target time of 1 second I would expect the the output to be :

 

000 (inital @ t=0)

111 (0.25 s)

000 (0.5 s)

-111 (0.75 s)

000 (1 s)

 

However, I end up repeating this set of data an absurd amount of times.  I think my problem is either in the number of samples control for the sine waves or in my elapsed time express VI, but I am completely lost.  Any suggestions would be greatly appreciated.

 

0 Kudos
Message 1 of 3
(1,937 Views)

Your while loop is running infinitely fast.  And every iteration of that while loop, you are completely writing out the entire dataset.

 

You need to put a wait function in your loop.  And if you want it written out 1 sample at a time, then you need to use index array to do that.

0 Kudos
Message 2 of 3
(1,933 Views)

Hello mbrupb

 

I did some modifications to your original VI, I used the simulated signal express VI as this has the option to simulate the acquitision time, but the csv file that you are creating does not include the time information, so I included a write to measurement file VI too, this will create a TDMS file that include the time information, I ran this on my system and as you can see in the image below at 0.25s the magnitute of the signals is aprox 1 (0.999...) the TDMS can be open in excel.

 

f03.jpg

 

I saved it for the 8.6 version tell me if it works for you

 

Warm regards,

 

Martin Garcia

Applications Engineer

 

 

0 Kudos
Message 3 of 3
(1,916 Views)