Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/21/02 11:12
Read: times


 
#27612 - T89C51RD2 can't rd/wr internal EEPROM
Hello all,
I wrote the following functions for reading and writing to the internal EEPROM but for some reason it not working.
Can some tell me what's wrong in this code?

void intEepromWr(void *pBuff,uint iEepromAddr,uint iBuffLen){
volatile uchar xdata *pIntEeprom = (uchar xdata *)iEepromAddr;

EECON = 0xFC; //Reset value
EETIM = 0x37; //5*11.0592MHz in normal mode
for (pSram=pBuff ; iBuffLen>0 ; iBuffLen--,pSram++,pIntEeprom++) {
while(EECON & 0x01);// Wait while eeprom busy
EECON = 0x02;// EEE=1 EEPROM mapped
*pIntEeprom = *pSram; // Write data to eeprom
EECON = 0x50;
EECON = 0xA0;
}
}

void intEepromRd(void *pBuff,uint iEepromAddr,uint iBuffLen){
volatile uchar xdata *pIntEeprom = (uchar xdata *)iEepromAddr;

EECON = 0xFC; //Reset value
EETIM = 0x37; //5*11.0592MHz in normal mode
EECON = 0x02; // EEE=1 EEPROM mapped
for (pSram=pBuff ; iBuffLen>0 ; iBuffLen--,pSram++,pIntEeprom++) {
while(EECON & 0x01); // Wait while eeprom busy
*pSram = *pIntEeprom; // Read data from EEPROM
}
EECON &= 0xFC;
}

Thanks a lot,
Roberto

List of 11 messages in thread
TopicAuthorDate
T89C51RD2 can't rd/wr internal EEPROM            01/01/70 00:00      
RE: T89C51RD2 can't rd/wr internal EEPRO            01/01/70 00:00      
RE: T89C51RD2 can\'t rd/wr internal EEPROM            01/01/70 00:00      
RE: T89C51RD2 can't rd/wr internal EEPROM            01/01/70 00:00      
RE: T89C51RD2 can't rd/wr internal EEPROM            01/01/70 00:00      
RE: T89C51RD2 can\'t rd/wr internal EEPROM            01/01/70 00:00      
RE: T89C51RD2 can\'t rd/wr internal EEPROM            01/01/70 00:00      
RE: T89C51RD2 can't rd/wr internal EEPRO            01/01/70 00:00      
RE: T89C51RD2 can\'t rd/wr internal EEPROM            01/01/70 00:00      
RE: Frank            01/01/70 00:00      
RE: T89C51RD2 can't rd/wr EEPROM - SOLVE            01/01/70 00:00      

Back to Subject List