我用的是STC8F8K16S4A12
写了一个简单的 EEPROM程序
while(1)
{
Flash_Erase(FLASH_ADDR_ID);
Delay_ms(100);
FlashDat = 0x0a;
FlashDat=Flash_Read_Byte(FLASH_ADDR_ID);
ucSenDat[0] = 0x01;
ucSenDat[1] = FlashDat;
Uart_Com_Send_Data(&ucSenDat[0],2);
/*
FlashDat=Flash_Read_Byte(FLASH_ADDR_ID+1);
ucSenDat[0] = 0x02;
ucSenDat[1] = FlashDat;
Uart_Com_Send_Data(&ucSenDat[0],2);
*/
FlashDat = 0x5b;
Flash_Write_Byte(FLASH_ADDR_ID,FlashDat);
FlashDat = 0x0b;
FlashDat=Flash_Read_Byte(FLASH_ADDR_ID);
ucSenDat[0] = 0x03;
ucSenDat[1] = FlashDat;
Uart_Com_Send_Data(&ucSenDat[0],2);
/*
FlashDat = 0xa2;
Flash_Write_Byte(FLASH_ADDR_ID+1,FlashDat);
FlashDat=Flash_Read_Byte(FLASH_ADDR_ID+1);
ucSenDat[0] = 0x04;
ucSenDat[1] = FlashDat;
Uart_Com_Send_Data(&ucSenDat[0],2);
*/
Delay_ms(1000);
}
打印出来的结果 01 00 03 5B 01 5B 03 5B 01 5B 03 5B 01 5B 03 5B 01 5B 03 5B 01 5B 03 5B 01 5B 03 5B 01 5B 03 5B 01 5B 03 5B 01 5B 03 5B 01 5B 03 5B 01 5B 03 5B 01 5B 03 5B 01 5B 03 5B 01 5B 03 5B 01 5B 03 5B
第一次是 ERASE 后是 0X00 后面就好像 ERASE 没有作用一样
请问那位大侠知道是怎么回事情 |