I2C写入E2PROM
在调用函数时,一致没有写入成功.
调用库函数,单纯的写入:
遇到问题:写入之后在去读取,数值一直不对.换了数值,E2PROM里的数值是一直没有变化的。
经过了一顿换值,几近放弃,又重新看了百度,还是不还用...
之后查看了库函数..
应该传入指针, 我一直在传入变量,传入变量后.
后来建立个数组.....
uint16_t away[]={5,10,15,20,25,30,35};
之后写入,读取就好用了,其实简单,给弄复杂了.
uint16_t away[]={5,10,15,20,25,30,35};
//process_poll(&LCD_KEY_ctrl_process);
while(1)
{
Data_ClearHourFlowAllFromEeprom();
uint8_t temp ;
I2C_EEpromClear();
//I2C_EEpromReadData(0x10, away,sizeof(away));
//DEBUG_PRINTF("AAAAAAA+%x+AAAAAAAAA",away[0]);
I2C_EEpromWriteData(0x2000,away, sizeof(away));
I2C_EEpromReadData(0x2000, away,sizeof(away));
DEBUG_PRINTF("-----------AAAAAA------------------------------");
DEBUG_PRINTF("AAAAAAA+%d+AAAAAAAAA",away[0]);
DEBUG_PRINTF("AAAAAAA+%d+AAAAAAAAA",away[1]);
DEBUG_PRINTF("AAAAAAA+%d+AAAAAAAAA",away[2]);
DEBUG_PRINTF("AAAAAAA+%d+AAAAAAAAA",away[3]);
DEBUG_PRINTF("AAAAAAA+%d+AAAAAAAAA",away[4]);
DEBUG_PRINTF("AAAAAAA+%d+AAAAAAAAA",away[5]);
DEBUG_PRINTF("----------AAAAAAA---------------------------------");
}