| ??? 11/19/07 19:04 Read: times |
#147208 - Problems writing EEPROM on AT89S8253 device |
I am using an Atmel AT89S8253 microcontroller and am having some issues when writing to EEPROM. I have recently changed to this device from the AT89S8252 device because of availability issues.
The manual on the device does not give a great example of EEPROM programming. The write and read works fine as long as i do not call 2 'writes' straight after each other. If i do the second one fails. Adding a small delay in between each write corrects the issue. I know EEPROM writes take some time but the check for EECON & EERDY should wait till the write has completed. I have implemented the write in 'page write' mode as this was one the manual gave the write sequence diagram in. Any suggestions (apart from adding the delay) would be much appreciated. Thanks, Andy
void WriteEEPROM (unsigned char xdata *addr, unsigned short Data)
{ // WriteEEPROM
EECON |= EEMEN;
EECON |= EEMWE;
EECON |= EELD;
*addr = Data >> 8;
EECON &= ~EELD;
*(addr+1) = (unsigned char)Data;
while (!(EECON & EERDY));
EECON &= ~EEMWE;
EECON &= ~EEMEN;
} // WriteEEPROM
short ReadEEPROM (unsigned char xdata *addr)
{ // ReadEEPROM
short Result;
EECON |= EEMEN;
Result = (*addr << 8) + (*(addr+1));
EECON &= ~EEMEN;
return (Result);
} // ReadEEPROM
|
| Topic | Author | Date |
| Problems writing EEPROM on AT89S8253 device | 01/01/70 00:00 | |
| I know this is entirely unhelpful, but... | 01/01/70 00:00 | |
| Try this... | 01/01/70 00:00 | |
| My anser | 01/01/70 00:00 | |
| Goofy chip | 01/01/70 00:00 | |
| Problems writing EEPROM on AT89S8253 device | 01/01/70 00:00 | |
| just to sample a few from this very Forum... | 01/01/70 00:00 | |
in an earlier post I wsrote | 01/01/70 00:00 |



