ARM Technical Support Knowledge Articles

ACCESSING INTERNAL EEPROM ON ATMEL 89S9252

Applies to: C51 C Compiler

Answer


Information in this article applies to:


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.

MORE INFORMATION

SEE ALSO

Article last edited on: 2006-05-05 17:39:09

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential