This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

EEPROM problem

I am using Temic 89C51RD2 microcontroller and I've tried to resolve
following problem for a long time. I have not any good ideas left, so I turn
to you. My problem is:
I'm using LARGE memory model. I try to program internal EEPROM with code
(only short part)

#pragma large
#include "D:/Keil/C51/inc/temic/89C51RD2.h" //added with EETIM and EECON
#define XBYTE ((unsigned char volatile xdata*) 0)
bit b;

EETIM = 0x37; //XTAL FREQ 11 MHz
EECON |= 0x02; //Enable EEPROM memory Set EEE bit
XBYTE [0x0000] = 0x02; //write data example
EECON = 0x52; //start programming
EECON = 0xA2; //...
do {
b = EECON & 0x01; //wait for EEBUSY-bit down -> programming done
}
while (b);

What's wrong. The program is always hanging in the programming phase. If I
use small memory model it won't hang. Reading from the EEPROM is also ok.

0