LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to write my measurement data to a file

Here I'm attaching two pictures, on of block diagram and other of front pannel

 

I am getting values from my fpga vi @ 25us per sample. And I'm reading them in RT vi and wanted to store it to a file.

 

So here it is, i tried this code for writting into a .csv and a .txt file.

Both the case the file is empty even after execution. And i learnt that the writting to file is a time consuming process which will obviously give me time outs in FPGA writting. So how shall i do it to make it a efficient way for writting my data into a file.

Download All
0 Kudos
Message 1 of 5
(2,995 Views)

Hi Rex_saint,

 

with the Write To Spreadsheet File.vi each iteration of the while loop you open -> write -> close your file with the data.

 

I have no experience with FPGA in Labview, but maybe you could use something like this

 

write to file.png

 

or use Producer-Consumer, queue data and write it in consumer loop...

Duri
0 Kudos
Message 2 of 5
(2,989 Views)

Duri is correct in that you should not be using the Write To Spreadsheet File.  Open/create the file once before your loop and close it once after the loop.  You will want to use the Array To Spreadsheet String and Write Text File inside of your loop in order to do the actual writing of the file.

 

If that doesn't work, then you may want to change how your are getting the data from your DMA FIFO a little.  Use the Elements Remaining output of the DMA Read to store that value in a shift register.  The # elements to read should be set to the value in the shift register.  Initialize the shift register to 0.  This way you are clearing out that DMA and you are not limiting the number of samples you can read.  You will also not be hammering your CPU while waiting for X samples to be entered in the DMA.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 5
(2,961 Views)

This is (atleast) the 3rd thread on the very same topic by Rex.

 

(Possible) solution was given here

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(2,948 Views)

I'm sorry.. I thought the last post didnt float, so reposted the content, and thank you GerdW, you idea helped.. I tried that and it is serving good

0 Kudos
Message 5 of 5
(2,916 Views)