以下是我写EEPROM程序代码,问题出在哪?另外想问下EEPROM怎么读?它的是从那个地址开始的?请各位指教,谢谢!
void EEPROMWrite(uint16 Address,uint16 WData) {
asm sei;
if(ECLKDIV_EDIVLD == 0) {
ECLKDIV = 0x4a;
}
if((ESTAT_PVIOL == 0) && (ESTAT_ACCERR == 0)) {
if(ESTAT_CBEIF) {
EADDRHI = (Address >> 8) & 0xff;
EADDRLO = Address & 0xff;
EDATAHI = (WData >> 8) & 0xff;
EDATALO = WData & 0xff;
}
}
ECMD = 0x20;
ESTAT = 0x80;
while(ESTAT_CBEIF == 0);
while(ESTAT_CCIF == 0);
asm cli
} |