Go Down

Topic: 保存数据到flash 或者EERPOM空间 (Read 3450 times) previous topic - next topic

leijixiaomile

Arduino 如何保存数据到Flash 或者EEPROM空间?

Star0312

要使用FLASH首先需要包括头文件:

#include

之后便可以使用PROGMEM来定义

比如有一段定义12864液晶字符的语句

//显示龙字样
const unsigned char F14x16[] = {
  0x10,0x10,0x10,0x10,0x10,0xFF,0x10,0xF0,0x12,0x1C,0xD0,0x10,0x10,0x10,
  0x40,0x20,0x10,0x0C,0x03,0x10,0x08,0x3F,0x42,0x41,0x40,0x40,0x40,0x70//龙
};


将这一段数组存入到FLASH只需要在函数后加入PROGMEM

const unsigned char F14x16[] PROGMEM= {
  0x10,0x10,0x10,0x10,0x10,0xFF,0x10,0xF0,0x12,0x1C,0xD0,0x10,0x10,0x10,
  0x40,0x20,0x10,0x0C,0x03,0x10,0x08,0x3F,0x42,0x41,0x40,0x40,0x40,0x70//龙
};

Go Up