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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

Jump to solution
1,331 Views
sureshkumar
Contributor I
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;
 
void
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
}
 
void
funtion_one()
{
   mydata = 'A';
   eeprom_write(&P_OTHER[5],mydata);
}
 
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 
Labels (1)
Tags (1)
0 Kudos
1 Solution
399 Views
J2MEJediMaster
Specialist I
Based on the clock speed you're using, I'm going to guess--and could be wrong--that you're trying to program a MC68HC908 derivative. You may want to consult the application note AA2295 which describes a serial bootloader that can handle EEPROM programming. The software is located in the zip file AA2295.zip.

If I'm wrong on the MCU type, I apologize, but this just makes the case where we forum moderators ask:

When you describe your problem, please mention the MCU and CodeWarrior version you're using in the subject line, please!

---Tom

View solution in original post

0 Kudos
1 Reply
400 Views
J2MEJediMaster
Specialist I
Based on the clock speed you're using, I'm going to guess--and could be wrong--that you're trying to program a MC68HC908 derivative. You may want to consult the application note AA2295 which describes a serial bootloader that can handle EEPROM programming. The software is located in the zip file AA2295.zip.

If I'm wrong on the MCU type, I apologize, but this just makes the case where we forum moderators ask:

When you describe your problem, please mention the MCU and CodeWarrior version you're using in the subject line, please!

---Tom
0 Kudos