Go Down

Topic: string management and memory limitation (Read 759 times) previous topic - next topic

Pierre7

Mar 27, 2014, 07:30 pm Last Edit: Mar 27, 2014, 07:40 pm by Pierre7 Reason: 1
Hello Arduino fans

I'm a bit new at this but willing to learn.  I am building a module to display text messages scrolling on a 16 by 2 LCD display.  Now please confirm but I think the addition of an SD card will be required to hold the text strings.  Or perhaps some kind of physical memory chip or other board would be better?  I would like the string values to remain after a power failure.

johnwasser

If you use a string constant ("This is a string constant") it is compiled into FLASH (*a.k.a Program Memory or 'progmem') and then copied to RAM at run time.  If you are using it for .print() or .println() you can use the F() macro (stream.print(F("This is a string constant"));) to keep the string in FLASH and print it directly from FLASH so it does not take up RAM.

There are also ways to keep lists of strings in FLASH.  See: http://arduino.cc/en/Reference/PROGMEM
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pierre7

#2
Mar 28, 2014, 02:09 am Last Edit: Mar 28, 2014, 02:12 am by Pierre7 Reason: 1
Thanks for pointing that out however I need to be able to manipulate the strings  something that cannot be done in flash . Perhaps some other type of memory could do the job? I do not mind adding a cr2032 batt to maintain state. Or use an SD card?

johnwasser

If you don't need all the strings in their 'manipulated' form at the exact same time you could always manually copy from FLASH to RAM buffer and do the manipulation there.  The buffer can be used for any number of string manipulations.

There is no way to add more RAM so whatever you connect to store strings you will have to copy the string into RAM to manipulate it and copy it back out to auxiliary memory for free up the RAM for the next manipulation.  There is a type of SPI memory called FRAM that I have heard is both non-volatile and fast: http://www.kerrywong.com/2012/01/15/using-fram-as-nonvolatile-memory-with-arduino/
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pierre7

#4
Mar 28, 2014, 12:27 pm Last Edit: Mar 28, 2014, 01:16 pm by Pierre7 Reason: 1

If you don't need all the strings in their 'manipulated' form at the exact same time you could always manually copy from FLASH to RAM buffer and do the manipulation there.  The buffer can be used for any number of string manipulations.

There is no way to add more RAM so whatever you connect to store strings you will have to copy the string into RAM to manipulate it and copy it back out to auxiliary memory for free up the RAM for the next manipulation.  There is a type of SPI memory called FRAM that I have heard is both non-volatile and fast: http://www.kerrywong.com/2012/01/15/using-fram-as-nonvolatile-memory-with-arduino/


http://upgradeindustries.com/product/7/FRAM-X-Add-on

Thanks for the FRAM tip. I will consider it seriously. I am assuming that it is way better than file/string runtime manipulation via an SD card?
Also according to arduino documentation

-Flash memory (program space), is where the Arduino sketch is stored.
-SRAM (static random access memory) is where the sketch creates and manipulates variables when it runs.
-EEPROM is memory space that programmers can use to store long-term information.


According to FRAM-X Add-on
512 bytes of non-volatile, ultra-lower power memory via I2C, which directly replaces EEPROM and FLASH.

What are the impact. Will the sketch load normally?


johnwasser


512 bytes of non-volatile, ultra-lower power memory via I2C, which directly replaces EEPROM and FLASH.

They mean that the FRAM chip has the same interface as common EEPROM and FLASH chips so it can be used as a drop-in replacement for such chips.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pierre7



512 bytes of non-volatile, ultra-lower power memory via I2C, which directly replaces EEPROM and FLASH.

They mean that the FRAM chip has the same interface as common EEPROM and FLASH chips so it can be used as a drop-in replacement for such chips.
What are the impact. Will the sketch load normally?

Go Up