LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Write Delimited Spreadsheet" don't write any data to CVS file, but data still goes to the model

Solved!
Go to solution

Hi,

I'm currently using a myRio to (potentially) log voltage and current data from a machine through its analog ports. I'm testing it with a signal generator generates a square wave in 10kHz. Data plotting onto the graph is fine, but it seems like I cannot write anything to a .csv file.

Any solution (and comment about my program) is welcome!

0 Kudos
Message 1 of 11
(4,176 Views)

Is it not creating a file?  Is it creating a file but it's empty?

 

If you put an error indicator on the Write to Delimited File, do you see an error there?

 

I'd get rid of the wait function in the consumer loop as the dequeue will control the rate.  But what is controlling the rate of data in the producer loop?

You should destroy the queue after the consumer loop ends.

 

Beyond what I pointed out, I don't see anything that explains the problems you say you are having.

0 Kudos
Message 2 of 11
(4,152 Views)

Well, it didn't create any new file what so ever. And if it does, I don't know where it gives me an option to create a name for the new file (does it even allow me to do so?), since I only specify the path to a folder. 

Is it possible that because I'm putting this VI under myRio in my project, it won't save the file? I'm still confused about how this work, as the plotting function is also in the VI, and obviously, it is plotting on my laptop, so how would saving the file cannot do the same?

About the controlling rate of producer, I have none. In fact, I want to control it in 10kHz or so, but it seems like the wait function can only receive at least 1 ms and not any faster. So I'm hoping by not specify the wait function, it will sample the data as fast as possible.

0 Kudos
Message 3 of 11
(4,135 Views)

You have a path control on your front panel.  In the VI you attached, it is empty, so I hope you are picking a file before you run your VI.  I don't know why you say you are only specifying a path to a folder.  If you are, then of course it isn't going to create a file since you haven't specified a file name.  (Did you put that error indicator on that function like I said?

 

If you right click on the path control and pick Browse Options, you'll see it is set to pick "Files" (Good).  But it is also set for "Existing Files".  So the file has to exist in order to pick it.  If you want to save to a new file, then you need to pick "New Files", or "New and Existing Files".

 

If you want 10 kHz rate, it is a little fast for software control which is exactly what you have set  up with 1 Sample acquisition.  Plus the fact it is an Express VI, and a MyRIO which I don't have, so I can't tell you how you internally setup that Express VI.  With real DAQmx devices, you create a task with a sample clock set for 10 kHz, continuous sampling, and you would read N samples at once, such as 1000 or 10,000 which reads chunks of samples at a time at and both the producer and consumer loops should be able to keep up at that sample rate since they'll only need to run 10 times per second, or just once per second.

0 Kudos
Message 4 of 11
(4,125 Views)

Aha! Now I see why people need all those error indicators. Yes, so I fix the problem of file name. But still, it didn't create any file at all.

Also, how does it know what file type to create anyways?

0 Kudos
Message 5 of 11
(4,116 Views)
Solution
Accepted by topic author Anh_Tran

Hi Anh,

 

I'm currently using a myRio …

But still, it didn't create any file at all.

Which filepath did you use?

I hope you already know that your myRIO is a computer of its own and CANNOT write a file to your PC's harddrive. (You don't want other computers to access your harddrive without notice…)

 

Now I see why people need all those error indicators.

Basic principle in software engineering: handle errors!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 11
(4,086 Views)

I did know myRio is a computer on its own but did not know it cannot write files to my computer! So how would you approach this problem then?

0 Kudos
Message 7 of 11
(4,073 Views)

Save the file in the myRIO…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 11
(4,047 Views)
Solution
Accepted by topic author Anh_Tran

@Anh_Tran wrote:

I did know myRio is a computer on its own but did not know it cannot write files to my computer! So how would you approach this problem then?


1. You can just write to the myRIO and then use FTP to get the data later.

2. Write an application that runs on your PC to accept the data from the myRIO over TCP/IP or Network Streams.  You will have to program your myRIO to send the data over whatever method you choose.  But the PC application can then do the logging for you.


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
Message 9 of 11
(3,999 Views)

The original message wasn't clear that this code was running on a myRIO itself.  All I saw was that a myRIO was being used to get the analog data.  I would have assumed the code was running on a PC and getting the data through scan mode, particularly when I saw an Express VI involved.

0 Kudos
Message 10 of 11
(3,982 Views)