LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Storing data in a .txt file (RT)

Hi,

I am trying to store data in text file with the vi shown bellow:

DavidGikas_1-1582019346315.png

 

It seems to be working when the VI is saved on my computer but not when the VI it is saved on my cRIO (Test1/nick-Crio).

I think it has something to do with the path that i am using but i wasn't able to figure out what is wrong.

I would appreciate if you could help.

Thank you, David.

 

0 Kudos
Message 1 of 14
(3,764 Views)

@DavidGikas wrote:

It seems to be working when the VI is saved on my computer but not when the VI it is saved on my cRIO (Test1/nick-Crio).


Pretty sure the cRIO doesn't have a c:\users directory.

 

Either create that path on the cRIO (once, or from the program), or use a path that is available on the cRIO.

 

You can make this work for both targets with a conditional disabled structure.

 


@DavidGikas wrote:

I think it has something to do with the path that i am using but i wasn't able to figure out what is wrong.


That is wrong.

 

But a lot more is wrong 🤔. The code that shows is a mess. I fear it's only a small part of the code.

 

Bugs hide in messy code. I'm pretty sure a lot more is wrong.

 


@DavidGikas wrote:

It seems to be working when the VI is saved on my computer 


With clear code, you would be able to say that with confidence. 😎

 


@DavidGikas wrote:

I would appreciate if you could help.


I recommend doing (free) courses.

And straightening wires.

And a few well picked sub VIs.

 

I threw in some emoticons. This is me being seriously concerned and trying to help.

 

I know it isn't easy when starting, but at some point you will get tired of bug fixes leading into other bug fixes, and adding features will simply not be possible soon.

Message 2 of 14
(3,742 Views)

It is David again,

It wasn't allowing me to post again so i have to make another account,

Thank you for your concern,

How do add a path from my c RIO to my computer programmatically?

0 Kudos
Message 3 of 14
(3,731 Views)

Use the Create Folder function.

0 Kudos
Message 4 of 14
(3,723 Views)

I still cannot get the path to work.

The Vi is storing the information when save on my computer but i am not sure how to handle the path when it is saved on my cRIO.

skata200_0-1582025016415.png

skata200_1-1582025053457.png

I tried using the create folder function but cannot figure out what to use as my path.

Can you be a bit more specific please

Thank you,

David

 

0 Kudos
Message 5 of 14
(3,713 Views)

If "C" exists, you can use Create Folder to create "C:\Users" to create a Users folder under "C". If you have the rights. Depending on the OS on the cRIO, it might return an error if you try that.

0 Kudos
Message 6 of 14
(3,698 Views)

This gives me the same outcome:

skata200_0-1582027560318.png

No error when the program is saved on my c-RIO but i do not get anything out of it.

I am pretty sure i has to do with the path.

When the VI i saved on my c-RIO it doesn't seem to understand any of the paths because they are on my computer.

When i tried the same think with the vi saved on my computer i am getting the files and the folders.

 

0 Kudos
Message 7 of 14
(3,693 Views)

Hi skata,

 


@skata200 wrote:

No error when the program is saved on my c-RIO but i do not get anything out of it.


Surely there will be an error, but you don't use/check any of the error wires…

 



@skata200 wrote:

I am pretty sure i has to do with the path.

When the VI i saved on my c-RIO it doesn't seem to understand any of the paths because they are on my computer.

When i tried the same think with the vi saved on my computer i am getting the files and the folders.


The cRIO CANNOT ACCESS the harddrive of your computer. Point. (It's a computer on its own!)

You need to make sure to use path available to your cRIO - most probably on the "harddrive" of your cRIO!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 14
(3,691 Views)

Thank you that makes a lot more sense i will have a look at that.

0 Kudos
Message 9 of 14
(3,687 Views)

I recommend giving this article a good read: Working with File Paths on Real-Time Targets 



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 10 of 14
(3,686 Views)