Hi Keil,
I sloved the EEPROM problem with AT89C51ED2, the problem was in the memory module selection.
Since I had selected large memory model, the EEPROM was not working, when I changed it to Small memory model,it started working fine.
But now my problem is my project is designed for Large memory model , How can I make this code work for Large memory model??
I checked it for Read operation, It was working fine, but It was not able to write to EEPROM with this large model!!
The code is,
/*======================================================================== FUNCTION TO WRITE DATA TO INTERNAL E2ROM OF AT89C51ED2 ========================================================================*/ void WriteE2ROM(unsigned char xdata *Addr,unsigned int e_data) { unsigned char idata FBuffer[6]; char idata i=-1; sprintf(FBuffer,"%d",(unsigned int)e_data); do { while(BUSY); EA=0; E_EEPROM; i++; // WRITE *(Addr+i) =FBuffer[i]; D_EEPROM; EA=1; }while(FBuffer[i]!='\0'); } /*=============================================================== FUNCTION TO READ DATA TO INTERNAL E2ROM OF AT89C51ED2 ===============================================================*/ unsigned int ReadE2ROM(unsigned char xdata *Addr) { unsigned char idata EBuffer[6]; unsigned int idata FData; unsigned char idata i=0; while(BUSY); EA=0; E_EEPROM; while(*(Addr+i)!='\0') { EBuffer[i] = *(Addr+i); // READ i++; } D_EEPROM; EA=1; EBuffer[i]='\0'; FData=atoi(EBuffer); return FData; }
Is there any better approch to write to eeprom ??? If it is please send me the correct way to approch the problem.