LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Send data of sensors to an USB pen

I am trying to send the data from my cRIO sensors to a .csv file on a USB pen but I am not getting it, when I do simulating data I can send the data to the USB pen but when I try on CRIO I am not getting it me error 43 Open / Create / Replace File in Write Spreadsheet String.vi-> Write Delimited Spreadsheet (string) .vi-> OPCUA_Server.vi

 

The vi's are.

 

Download All
0 Kudos
Message 1 of 10
(2,188 Views)

The path names are different on a Windows system and a CRIO, You need to use the appropriate file path for each platform.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 10
(2,136 Views)

Hi, can you show an example in cRIO? When i put the USB pen in cRIO the letter of unit is "u" and file path i used is /u/Folder/file.extension.

0 Kudos
Message 3 of 10
(2,128 Views)

@smalhao wrote:

Hi, can you show an example in cRIO? When i put the USB pen in cRIO the letter of unit is "u" and file path i used is /u/Folder/file.extension.


 

You basically answered your own question. Your code for the CRIO has a path of "e:\folder\filename.ext". The path on the CRIO code needs to look like the above. You can place the path constant in a conditional diagram structure and use the "TARGET_TYPE" to change the base path based on the type of system you are running on.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 10
(2,121 Views)

I can create the archive, but now it doesn't send me the data to the archive in the moment, I put a probe to see if the file's input arrived and the values ​​get there, but then when I open the file it's not there, only after stopping the file saw is that appear. The vi file i use is the attached

0 Kudos
Message 5 of 10
(2,070 Views)

What is a "USB Pen"?  I have never heard of that phrase before.  Are you talking about a USB flash drive?

 

By "stopping the file", do you mean stopping the VI and allowing the file close to execute?

I imagine the operating system might buffer the writes going to the file and will wait to write the data in one shot when you close the file, or perhaps periodically to minimize the write activity to the flash drive.

 

 

0 Kudos
Message 6 of 10
(2,044 Views)

Yes USB Pen is the USB flash drive, normally in Portugal we call USB Pen.

 

I have been with cRIO working with the Vi file and have noticed that from time to time it writes the data to the file. I don't know if there is another way to write data to the file in real time, does it exist?

0 Kudos
Message 7 of 10
(2,006 Views)

I'm going to guess there is not as I believe the buffered writes are a method used in the driver so that it extends the life of the drive.  Those flash devices have a finite number of writes in their lives, so too frequent writing that would happen sending a few bytes at a time rather than grouping writes into the individual blocks would rapidly degrade the device.

 

However, if you don't care about that, the File Flush function might force the writes to the drive.

 

But what problem are you really trying to solve here?  There might be a better way.  You say you want to "write data to the file in real time", but files and "real time" are actually rather contradictory.  Is something else trying to read the file at the same time the cRIO is writing to it?  That just seems like a bad idea.  There are better methods to transferring data rather than relying on a file on a flash drive.

0 Kudos
Message 8 of 10
(1,994 Views)

I have a cRIO with several sensors connected to it via a D-SUB plug and I already have the acquisition of the sensor data and now I want to save that data for example every 10 seconds in a file, how else can I do that?

0 Kudos
Message 9 of 10
(1,990 Views)

You can save every 10 seconds to a file.

Or you can accumulate the data in memory and save it to the file less frequently like once per minute, or once every 5 or 10 minutes.

 

What is your need for "real time", and precisely what do you mean by that?

0 Kudos
Message 10 of 10
(1,986 Views)