Writing files on R2 that persist through power fail


#1

Is there a way to write a file on an R2 controller that will persist through a power cycle? I’m pretty sure if you use an SD card to write to, it’ll work, but it’s nigh impossible to even find the SD cards small enough to work on an R2 anymore, and the file I’m trying to write is very small anyhow.

The application is that there are setpoints that I want to save for ‘backup’. I’d like to write a file of the setpoints that can be read back in. All this is done, and works well, other than the fact that a power cycle loses the file, unless I manually use Pac Manager to save the files on the machine to flash memory.

Is there a ‘save files to flash’ command at all? If there is, I haven’t found it yet.


#2

Never mind- got it. After much searching, I finally found the command:

SaveFilesToPermanentStorage();

This will write the files to flash after I’ve saved them (which is only on operator demand). Thanks anyway!! :slight_smile:


#3

Hi Todd,

Glad you found it, and glad to hear it’s only on operator demand (since you wouldn’t want to accidentally call that command too many times in a loop).

While you’re writing files, here’s another link that may be helpful if you want to get a listing of what all files you have:
http://www.opto22.com/community/showthread.php?t=252&p=833&viewfull=1#post833

Happy file saving!
-Mary


#4

Dont forget about form 1703; http://www.opto22.com/site/documents/doc_drilldown.aspx?aid=3162
(Also quick and easy to get to when you are in PAC Control, click on Help -> Commands -> Quick Reference).

It lists all the commands by function. And, its searchable. So in this case, open it, hit CTRL+F and type ‘Save’, and that command is the first result.

When I am doing anything new, I always have this doc open on my second monitor/task bar.

Even if my search is slightly off wordage or topic, you can usually see enough to fine tune what you are needing to do and go from there.

Its both a power users doc and a just-starting-out doc.

Very handy.