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

Declaring RAM areas for P89C668 (xdata problems)

I believe I'm doing something incorrectly, probably relating to how I initialize and tell keil where RAM memory resides at.

I'm using the latest version of uVision and C compiler. The P89C668 has 8k of onboard RAM.

As I understand it, the P89C668 has the normal 256 bytes of 'internal' RAM and the rest is accessed as XDATA. So once setting Keil up, I edit the startup such as:

IDATALEN        EQU     100H
XDATASTART      EQU     101H
XDATALEN        EQU     2000H
PDATASTART      EQU     0H
PDATALEN        EQU     0H

In the Options for Target, under the Target tab, I have the following settings:

Use On-chip ROM (0-FFFF) - Checked
Use On-chip XRAM (0-1EFF) - Checked
Use multiple DPTR registers - Checked

Nothing is in the Off-chip code or Xdata boxes and code banking is unchecked.

Is this correct?

My test setup consists of a Philips Mk2 emulator which has an 2x16 LCD attached. My LCD routines make use of a little RAM buffer declared like:

unsigned char idata lcdbuf[2][16];

I have a function that first writes the contents of a passed buffer to lcdbuf and then displays whats in the buffer to the actual LCD:

WriteLCD("Hello Keil\n", LCD_LINE1);
WriteLCD("XDATA Prob\n", LCD_LINE2);

I run this on my emulator and it works perfectly everytime.

Now, I change the data to xdata as follows:

unsigned char xdata lcdbuf[2][16];

Now when I run the program on my emulator, I get all blanks on the LCD, as if the memory were not accessed correctly. Being that was the only thing changed, I'm convinced it's some RAM setting somewhere.

Any ideas about what I could be doing incorrectly?

Thanks
James

0