LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compact Flash Storage Question

I have an ebmedded program on a cFP-2120 which is saving data to a compact flash card.  If I access the card via FTP I can transfer all the data but when I turn off the datalogger and then pull the card and put it in a computer I see a file of zero size.  The embedded program runs a continuous loop so it does not have a file close function (this is a simple test of CF use).  Is this a problem caused by the lack of file closure?
0 Kudos
Message 1 of 4
(3,117 Views)

Hi Gizmaa,

 

It is possible that the problem you are seeing is due to not closing the file that you are writing depending on how data is being written to the flash card. Try including a file close VI in your program and see if that fixes the problem. It is good practice to include a file close VI after the loop with read or write VIs so that multiple files are not continually opened and problems like yours are avoided.

 

Regards,

Stephen S.

National Instruments
Applications Engineering
Message 2 of 4
(3,094 Views)

Is there a write method that is more fault tolerant?  If my datalogger goes down for any reason I don't want hours/days of data lots.

0 Kudos
Message 3 of 4
(3,087 Views)

Hi there,

 

If I was programming this, I would do a daily or weekly file (Brand new from scratch). This would lower the risk of corruption in case of a crash, and make it more easy to get back the data. 

For the Closure of the file, I would program a small routine that would close the file every day/hours/minutes and reopen it at the next itteration with the append to file option turned on.(you can do this with a case structure that would be on at regular intervals) This would limit the number of time costly file access, and still close the dfile on a regular basis (allowing an easier recovery) .

The problem if you use a simple write to file function is that it will open write and close a file at every call (this is starving the processor), but if you do it once in a while, it doesn't hurt too much....

 

I hope this helps

 

Matthieu

0 Kudos
Message 4 of 4
(3,063 Views)