| ??? 05/26/03 11:31 Read: times |
#46646 - AT89s8252 Eeprom |
Please comment on code, as i am having the following problem.
// *********************** Read Byte from 89S8252 EeProm ********************* // Address Range: = 0x000 - 0x7ff // This function initiates a read form the EeProm. It returns the byte // value at the selected address // // *************************************************************************** unsigned char Read_EeProm(unsigned int Address) { unsigned char c; WMCON |= EEMEN_; // Internal EEPROM Access Enable: 1 = Enabled if(EERDY_) { c = *(unsigned char xdata *)Address; } WMCON &= ~EEMEN_; // Internal EEPROM Access Disable: 0 = Disabled return c; } // *********************** Write Byte to 89S8252 EeProm ********************** // Address Range: = 0x000 - 0x7ff // Value: = 0x00 - 0xFF // This function initiates a write to the EeProm. It returns the 1 to indicate // that the write has taken place , and 0 to indicate that the eeprom is still // busy, thus it can't write. // // *************************************************************************** unsigned char Write_EeProm(unsigned int Address, unsigned char Value) { if((WMCON & EERDY_) == 0) // EEPROM Ready / Busy Flag. 1 = Ready / 0 = Busy { return 0; } else { WMCON |= EEMEN_; // Internal EEPROM Access Enable: 1 = Enabled WMCON |= EEMWE_; // Internal EEPROM Write Enable: 1 = Enabled *(unsigned char xdata *)Address = Value; while ((WMCON & EERDY_) == 0) // EEPROM Ready / Busy Flag. 1 = Ready / 0 = Busy { } WMCON &= ~EEMWE_; // Internal EEPROM Write Disable: 0 = Disabled WMCON &= ~EEMEN_; // Internal EEPROM Access Disable: 0 = Disabled return 1; } } On (COLD)Power-up not (push-button)reset (Ds1232) i seem to lose the Eeprom data ?? Does this have any relation to my code ? Please assist if posable Thanks |
| Topic | Author | Date |
| AT89s8252 Eeprom | 01/01/70 00:00 | |
| RE: AT89s8252 Eeprom | 01/01/70 00:00 | |
RE: AT89s8252 Eeprom | 01/01/70 00:00 |



