PROGMEM is a keyword used when declaring a variable that keeps the data in flash instead of copying it into SRAM. It is part of the `pgmspace.h` library. Use this tag for discussions about using this attribute.
4
votes
2answers
75 views
How is a 41KB char array filling up 256KB of program memory?
I have an array of 41,400 elements of type char, which I am trying to put in program memory on a Mega2560. It should have 256KB of flash memory, but when I try to compile my sketch, it says the size ...
1
vote
1answer
34 views
Inherent delay running EEPROM.read()
I'm using EEPROM to store long term data for use in sketches (thanks to DarthRubik for the guidance). I store stuff like a location ("Garden") and a device name ("Greenhouse Monitor 02") plus ...
1
vote
1answer
33 views
Possible to “inline” PROGMEM strings into a structure array initialization?
I have the following structure:
struct inst_t {
const char *s1;
const char *s2;
};
I'd like to initialize a constant array of this structure like this where all the strings are PROGMEM'ed:
...
1
vote
1answer
26 views
Possible to determine at runtime whether a pointer is declared PROGMEM?
Is it possible to determine at runtime whether a pointer points to PROGMEM'ed values or regular values? This would give some flexibility when writing code that handles both.
1
vote
1answer
72 views
Saving byte array in PROGMEM instead of SRAM
For an ethernet project I do, I need to store the Ethernet Shield's MAC address.
I store it like that:
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0F, 0xE1, 0x85 };
That works OK, but in my project I need ...
3
votes
2answers
211 views
How to correctly pack an unsigned long from 3 unsigned chars?
I would like to use 652 unsigned long values on an Arduino Uno, but it doesn't look like there's enough memory. I thought about the splitting unsigned long values to 3 unsigned chars to store in ...
1
vote
3answers
101 views
Storing array in PROGMEM
I have an array of a lot of numbers (1 and 0) but i can't store them since arduino does not have enough space. How can i save an array of example 00110 in PROGMEM, then read from PROGMEM and set x to ...
0
votes
3answers
51 views
How to store IR data needed for AC controll in less space?
I'm trying to controll an AC unit but the issue is space - right now, I store the data like this:
consts PROGMEM unsigned int Signal_Heat_Fan0_Temp30[] = ...
0
votes
1answer
118 views
Better method for PROGMEM data access with multiple indirection?
-edit-
This is a simplified recreation of personal learning project I have ongoing. My issue is in accessing data in flash, the path to which includes multiple layers of indirection. When the data ...
0
votes
2answers
879 views
Using PROGMEM to store array of structs
I am hitting the limits of my arduino's SRAM and found that SRAM usage can be reduced by storing static stuff in flash memory instead of SRAM.
My project can (optionally) be built with an included ...
0
votes
3answers
103 views
How do I upload sketch (and parameters) through a user interface
I'm pretty new to Arduino and I'm developing my first real-world project.
I have a Arduino Mega with a full working sketch in it which is going to be placed in several distant places and I have a ...
0
votes
1answer
67 views
Unusual behaviour when moving data to PROGMEM
I've got some working code with a definition that looks like this:
const unsigned char DynTextPositions[10][4][4] = {
...
};
Which is defined / referenced via a header:
#include ...
1
vote
1answer
38 views
Sketch stops printing after writing a few times
I am trying to build a random horoscope printer. I have a series of strings in an array which I am storing in program memory. I then pick a random number and print that index concatenated with a ...
5
votes
1answer
924 views
What are the benfits of global variables over static class members?
On an embedded system we use global variables often to keep dynamic memory consumption on heap and stack low. But global variables are also considered bad programming practice if they aren't used in a ...
0
votes
1answer
191 views
Data from PROGMEM array mismatches initialisation
The amount of memory needed for my user interface is outrageous. Hence I decided to use flash memory. But after some successful readouts from program space, problems emerge.
Updated:
I have some ...
5
votes
3answers
3k views
PROGMEM: do I have to copy data from flash to RAM for reading?
I have got some difficulties understanding the memory management.
Arduino documentation says, it is possible to keep constants like strings or whatever I don't want to change during runtime in ...
0
votes
1answer
143 views
question about progmem
I have a problem understanding the following code:
PROGMEM prog_uint16_t x={1232,3232,43343};
rawlen = pgm_read_word_near(x);
memcpy_P(uSendBuff, pfSendBuff+1, rawlen * sizeof(uint16_t));
Why do ...
8
votes
1answer
5k views
Can I write to Flash Memory using PROGMEM?
On the documentation of Arduino, I quote:
http://playground.arduino.cc/Learning/Memory
Note: Flash (PROGMEM) memory can only be populated at program burn time. You can’t change > the values in ...
3
votes
2answers
124 views
PROGMEM char* mangled text
I wrote a program using PROGMEM for massive string arrays. One of the arrays worked, but when I added the second one, the serial output only puts out "th".
Pastebin Code: http://pastebin.com/9U7QZQKn
...
0
votes
1answer
96 views
Unrecognizable Message From PROGMEM char*
I'm using a PROGMEM char* to store a massive array. When I try to print a certain part of the array, the message comes out mangled. How do I fix this?
The output should be "Poliwag", but it comes out ...
9
votes
2answers
5k views
Why can I not use pointers instead of array with PROGMEM?
I'm currently changing some libraries to use flash instead of RAM for string storage so that I do not run out of SRAM on a project.
Some strings in the library are declared in this manner:
const ...