0

I am an arduino enthusiast and i am new to it.just wanted to know weather the micro processor itself could create a file in its memory while its is running. I know that it is possible to read a write from a file in c++ but is it possible to do so in an arduino (while it's running).

  • Can you explain what you're trying to achieve? Are you just looking for a way to store long-term data on the Arduino, or do you want another device to be able to read the file as well? – Peter Bloomfield Oct 15 '14 at 15:27
  • You can connect a SD-card, and communicate to it via SPI. – Gerben Oct 15 '14 at 15:34
  • I am trying to save the output from a sensor as a text file temporarily which I can later tansfer to a PC – Sree Hari Unnithan H Oct 15 '14 at 15:42
  • 2
    You can save it in a buffer in RAM, and if you maintain power and avoid reset then list it out on the debug serial interface and capture it on the PC side. Or if it is bigger or you want it to last longer, you can use an SD card as already described. An on-board SPI flash would be cheaper, but requires you to build the functionality for dumping the data over the serial and capturing it. – Chris Stratton Oct 15 '14 at 15:56
1

To answer the original question: Basically, yes, you can write libraries to implement a file system using the memories of an embedded microcontroller.
However, if it's feasible highly depends on the controller architecture and its peripherals.
Some of them (e.g. the one on Arduino Due) allow Flash reprogramming while an application is running from Flash.
Others require to have the application running in a special boot block or even in RAM when accessing the Flash for writing (this should be the case on an Arduino Uno)
And others don't allow Flash accesses from application at all.

Anyway:
The use of this for your purpose is very little, because the interface to the PC would also have to support the file system (for example, you could implement a FTP server and use an Ethernet connection...).
Therefore, the SD card approach is surely a very good suggestion.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.