Keil Logo

C51: ACCESSING INTERNAL EEPROM ON ATMEL 89S9252


Information in this article applies to:

  • C51 All Versions

QUESTION

I was looking for information concerning writing to and reading from the 2K EEPROM space of the AT89LS8252. Does the Keil C language directly support this? Are any examples available?

ANSWER

  1. To access AT89S9252's internal EEPROM, you must drive a flag in a new special function register called WCON (this register controls both: EEPROM access and Watchdog timer).
  2. If you'll only read the internal EEPROM (not write) and your system will NOT have external RAM, then you can access the EEPROM as if it were external RAM by:
    • Initially configuring the EEMEN bit that is part of the WCON special function register and that switches the access to the internal EEPROM instead of external RAM through MOVX instruction.
    • Generating a BIN file with the data for your EEPROM (the ISP software created by ATMEL to program the AT89s and AT90s allows both to write code memory and EEPROM memory).
    • Creating a const variable (ie a pointer) that points to the address of the EEPROM to access:

    For example, the following pointer definition may be used to read a string starting at address 0x010 of the internal EEPROM of AT89S8252 (note that the pointer is stored in the "data" memory space while it points to the "xdata" memory space and don't forget to set up the EEMEN bit):

    data const char * xdata MESSAGE = ((const char *) 0x010);
    
  3. If you want your program to write to the EEPROM or your system has external RAM, then you'll have to create specific subroutines.

SEE ALSO

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Wednesday, September 21, 2016


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.