Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Saving Text to a File on cRIO (http://www.chiefdelphi.com/forums/showthread.php?t=90160)

AB Steven 26-01-2011 16:51

Saving Text to a File on cRIO
 
Does anyone know how to do it? The labview sample isn't working for me, and mine doesn't work either, Google just turns up getting started with labview pdfs from FRIST that don't explain this. Here is what I have right now.

"test" and "text" are both files I created on the cRIO. The "text" one is the example with a constant file path instead of the default variable one. The "test" version was the one I made. They both have the extension .txt and I've tried with and without the extension in the file path.
Thanks in advance,
Steven

Joe Ross 26-01-2011 17:37

Re: Saving Text to a File on cRIO
 
I use c:\test.txt for the path.

AB Steven 26-01-2011 17:45

Re: Saving Text to a File on cRIO
 
I put a copy of each at C:\ on my computer, it didn't write to it. Our cRIO's directory is just / so "text.txt" would be /text.txt not C:\text.txt, at least I think so :confused:

Mark McLeod 26-01-2011 18:08

Re: Saving Text to a File on cRIO
 
1 Attachment(s)
Here's an example of creating/opening/saving a file on the PC side.

I want to double check the cRIO version, because I haven't done it in awhile.
The file path is the only tricky part. Try out Joe's suggestion.

Joe Ross 26-01-2011 18:35

Re: Saving Text to a File on cRIO
 
Quote:

Originally Posted by AB Steven (Post 1009016)
I put a copy of each at C:\ on my computer, it didn't write to it. Our cRIO's directory is just / so "text.txt" would be /text.txt not C:\text.txt, at least I think so :confused:

When the robot program runs and sees c:\ it puts on the root directory of the cRIO, not your computer.

Omar 27-01-2011 10:58

Re: Saving Text to a File on cRIO
 
Joe is right and if you want to get the file from the cRIO you will have to use FTP to get it from the cRIO to your computer.

Another option is to send the data with the dash board data and capture it there.

Omar

AB Steven 27-01-2011 15:48

Re: Saving Text to a File on cRIO
 
Ok I checked the cRIO again and pointing labview to C:\ did work. Thanks guys! I got the spreadsheet writer working, but only a one column deal, does anyone know how to get it into two columns?

Ether 27-01-2011 16:29

Re: Saving Text to a File on cRIO
 
Quote:

Originally Posted by AB Steven (Post 1009842)
Ok I checked the cRIO again and pointing labview to C:\ did work. Thanks guys! I got the spreadsheet writer working, but only a one column deal, does anyone know how to get it into two columns?

Write a CSV text file. Excel can open that directly if you associate the file extension.



AB Steven 27-01-2011 17:44

Re: Saving Text to a File on cRIO
 
I can get what I'm writing into Excel just fine, but I can only write one variable to the file. For example one potentiometer is at 70 the other at 450, I can only write the 70 or the 450 not both with a comma or some such thing in between. Currently I get it to write one number per line for example:
70
71
72
70
65
68
So that is keeping track of one potentiometer. I want both in one like this:
70,450
71,451
72,452
70,450
65,445
68,468
That would be potentiometer1,potentiometer2. Hope that helps, here is what I have right now.

Ether 27-01-2011 18:09

Re: Saving Text to a File on cRIO
 
Quote:

Originally Posted by AB Steven (Post 1009937)
I can get what I'm writing into Excel just fine, but I can only write one variable to the file. For example one potentiometer is at 70 the other at 450, I can only write the 70 or the 450 not both with a comma or some such thing in between. Currently I get it to write one number per line for example:
70
71
72
70
65
68
So that is keeping track of one potentiometer. I want both in one like this:
70,450
71,451
72,452
70,450
65,445
68,468
That would be potentiometer1,potentiometer2. Hope that helps, here is what I have right now.

I'm not a LabVIEW guru so I can only speculate:

Does LabVIEW have a function analogous to printf? If so use that to write both variables in one operation to one line in the file.

or...

Does the LabVIEW file output function you are using have an option to allow you to suppress the newline? If so, write the first variable without the newline, write the comma without the newline, and finally write the second variable with the newline.



AB Steven 27-01-2011 18:27

Re: Saving Text to a File on cRIO
 
I got it working, hers a picture of how. Thanks for the help guys.

Alan Anderson 27-01-2011 21:27

Re: Saving Text to a File on cRIO
 
Quote:

Originally Posted by Ether (Post 1009947)
Does LabVIEW have a function analogous to printf?

Indeed it does. It's the Format Into String function.


All times are GMT -5. The time now is 10:07.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi