28 September, 2015

Arduino: store 64-bit integers in PROGMEM

Honestly speaking, modern software does fairly simple things, but it requires gigabytes of memory; much more than they actually needed.

But with Arduino each byte is under control. And I like it. Simple programs works in a simple way and requires reasonable amount of resources.

Modern Arduino (based on ATmega328P) has:

2 KB of RAM

32 KB of Flash

1KB of EEPROM

Much enough memory for good program )

It is possible to store the data in the Flash area via the PROGMEM modifier in the code.
If you going to use the data from the Flash (PROGMEM) then you have to read it back into RAM.

I found it useful to keep 8x8 animation (created using the LED Matrix Editor) for LED dot matrix in the Flash instead of RAM. In my program each image is a 64-bit unsigned integer (uint64_t); an animation - is a series of these images.