ARM Technical Support Knowledge Articles


Applies to: uVision Debugger


Information in this article applies to:


Does the uVision Debugger simulate the on-chip EEPROM of the various 8051 Devices? I'm using an Atmel AT89C8252 and need to simulate EEPROM programming and review and modify the contents of the on-chip EEPROM.


Yes. The uVision Simulator includes simulation for almost all 8051 devices with on-chip EEPROM. This includes Atmel variants like the AT89C8252, T89C51RD2, T89C51CC01, and Analog Devices variants like the ADuC812, ADuC824, and so on.

The EEPROM space of the various devices is simulated in uVision using the V: memory type prefix. This memory space can be manipulated using standard uVision debugging commands. For example:

D V:0                            // displays the EEPROM memory space
SAVE EEPROM.HEX V:0, V:0x7FF     // saves the EEPROM memory space
LOAD EEPROM.HEX                  // loads the EEPROM contents

It is possible to display variables in the EEPROM space using standard uVision features like the Watch Window or the Memory Window.

You may modify the contents of any memory area using the Memory Window. Simply open the Memory Window and enter V:0000 in the Address input line. Right-click on the byte you want to modify and select Modify Memory from the context menu.

Implementing EEPROM programming routines for the AT89C8252 is easy. The following example code accesses the EEPROM of the AT89C8252.

#include <AT898252.H>
#include <absacc.h>

 * Return EEPROM Byte at address 'adr'
unsigned char ReadEEPROM (unsigned int adr)  {
  unsigned char v;

  WMCON |= EEMEN_;   //  enable EEPROM
  v = XBYTE[adr];    //  read value
  WMCON &= ~EEMEN_;  //  disable EEPROM
  return (v);

 * Write EEPROM Byte 'val' at address 'adr'
void WriteEEPROM (unsigned int adr, unsigned char val)  {
  WMCON |= (EEMEN_ | EEMWE_);     // enable EEPROM and set write bit
  XBYTE[adr] = val;               // write value
  while ((WMCON & EERDY_) == 0);  // wait until value programmed
  WMCON &= ~(EEMWE_ | EEMEN_);    // disable EEPROM and write strobe

unsigned char v;

void main (void)  {
  v = ReadEEPROM (0x200);         // read EEPROM address 0x200
  WriteEEPROM (0x200, 6);         // write 6 to EEPROM address 0x200
  while (1);


Refer to the sample program provided in the KEILC51EXAMPLESFARMEMORYE2PROM folder. This example program access the EEPROM memory of the Atmel T89C51RD2 using the far memory type supported by the LX51 Linker/Locater that is part of the PK51 Professional Developers Kit. This example allows you to declare far variables that reside in the on-chip EEPROM. You may adapt the programming routine in the XBANKING.A51 file to the chip that you use.


Article last edited on: 2004-05-10 17:32:07

Rate this article

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