AnsweredAssumed Answered

Hi Experts,      I have problem with EEPROM programming,...

Question asked by Abdul Mutalib on Jun 15, 2007
Latest reply on Jun 15, 2007 by Tom Thompson
Hi Experts,
   I have problem with EEPROM programming, I have code that will program a byte in EEPROM with the parameter send by calling function. But,when it execute, the routine will program the entire 512 bytes instead of just a byte. I confirm my EECR also set to write just 1 byte. My code are below, did my code wrong or is that some other bits in the register I need set in proper way.
unsigned char P_OTHER[10]    @0x00000800;         //eeprom address start here
unsigned char mydata;
eeprom_write(unsigned char* add, unsigned char data) {
 EECR = 0x06;                          //eelat=1,auto terminate=1
 *add = data;                             //byte to program
 EECR_EEPGM = active;        //turn on programming voltage
 while(EECR_EEPGM);           //wait until programing done
 EECR &= 0xFB;                     //clear eelat and eepgm
   mydata = 'A';
my EEDIV is set to 0x8056, my crystal running on 9.8304MHz. EEPROM clock is set bus clock.
Even my erase routine does the same. ex. when I erase just a byte, it goes to entire eeprom array.
I notice all this when I debug the program in MON08. Could you help me out on this.
Thanks Guru's