|
发表于 2012-11-10 21:11:49
|
显示全部楼层
本帖最后由 hell-prototypes 于 2012-11-10 23:07 编辑
是不是没有把图形数据定义到FLASH里去:
How do I put an array of strings completely in ROM?
There are times when you may need an array of strings which will never be modified.
In this case, you don't want to waste ram storing the constant strings.
The most obvious (and incorrect) thing to do is this:
//改贴正确的:
#include <avr/pgmspace.h>
const char foo[] PROGMEM = "Foo";
const char bar[] PROGMEM = "Bar";
PGM_P array[2] PROGMEM = {
foo,
bar
};
int main (void)
{
char buf[32];
PGM_P p;
int i;
memcpy_P(&p, &array, sizeof(PGM_P));
strcpy_P(buf, p);
return 0;
}
多谢楼下指正,没认真看清楚就给贴出来了,误人子弟啊。。。不好意思。。改过来了 |
|