LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write string to text file in cRIO

Dear All,

I'm new to cRio/FPGA and was hoping someone can enlighten me as to why I'm strugging to write a string to text file.

I'm sure there is a very obvious reason.

Hopefully the image illustrates my issue more clearlystring to txt file1.jpg

0 Kudos
Message 1 of 10
(4,320 Views)

Use the Write To Text File instead of the Write To Binary File.  You also shouldn't have to make it an array of strings.


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 2 of 10
(4,295 Views)

Hi crossrulz,  Many Thanks for the swift reply

I appreciate the use of Write To Text File as opposed to Write To Binary File but in practice I have a series of strings, numerics, carriage returns and tabs and therefore find the build array and write to binary easier to deal with. 

My issue is not so much writing strings to file but rather why does my VI operate correctly from one location but not the other. 

0 Kudos
Message 3 of 10
(4,285 Views)

The C:\ drive exists on your PC.  It does not exist on the cRIO.  The drive on the cRIO has a different designation.

0 Kudos
Message 4 of 10
(4,279 Views)

File paths may be a bit different on RT targets as this White Paper explains.

 

http://www.ni.com/tutorial/14669/en/

 

I would also make sure you include a file extension in your path.  Usually it's smart enough to handle a lack of extension but sometimes I have seen programs look for folders instead of making a file if you do not have an extension.

Matt J | National Instruments | CLA
0 Kudos
Message 5 of 10
(4,272 Views)

Thanks for that - its starting to make some sence.

I probably need to rethink my approach but I guess there is no harm in ansking more stupid quistions first; so, is there a way of writing strings from the Rio front screen to the c: drive (info of a measured sample) ?

 

0 Kudos
Message 6 of 10
(4,268 Views)

aw1 wrote: so, is there a way of writing strings from the Rio front screen to the c: drive (info of a measured sample) ?

The proper way would be to make a Windows program that the cRIO can stream the data to (network streams work very well here) and then the Windows application writes the data to your C drive.

 

I've heard mixed with this method, but another possibility is to create a shared folder on your computer that the cRIO can then access using the network folder name.


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 7 of 10
(4,253 Views)

That would require something to send messages from the cRIO to the Host PC.  Shared Variables are common, but can be lossy.  Is there anything that prevents you from storing it on the cRIO and then using the FTP later to copy te file over to your host?

Message 8 of 10
(4,252 Views)

@natasftw wrote:

That would require something to send messages from the cRIO to the Host PC.  Shared Variables are common, but can be lossy.  Is there anything that prevents you from storing it on the cRIO and then using the FTP later to copy te file over to your host?


Network Streams are the way to go, not shared variables.

 

Simply using the FTP or WebDAV (since the FTP is being deprecated) is the simplest way to go, by far.


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 9 of 10
(4,246 Views)

I always forget those Network Streams.  The few things I do with sending info back and forth generally doesn't require the lossless behavior 😃

 

Although, a simple right-click and select option in MAX is just as easy as everything else and far simpler to program.

0 Kudos
Message 10 of 10
(4,225 Views)