Keil Logo Arm Logo

Declaring RAM areas for P89C668 (xdata problems)

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
James Corbin
Posted
6-Jul-2003 22:53 GMT
Toolset
C51
New! 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
Read-Only
Author
James Corbin
Posted
6-Jul-2003 23:01 GMT
Toolset
C51
New! RE: Declaring RAM areas for P89C668 (xdata problems)
BTW, it seems to simulate correctly (the reading\writing xdata part).
Read-Only
Author
James Corbin
Posted
7-Jul-2003 02:20 GMT
Toolset
C51
New! RE: Declaring RAM areas for P89C668 (xdata problems)
http://www.keil.com/support/docs/1978.htm

Answered my own question.

Thanks
James
Read-Only
Author
Vuppuladhadium Venkataramana
Posted
1-Aug-2003 19:56 GMT
Toolset
C51
New! RE: Declaring RAM areas for P89C668 (xdata problems)
I guess you know the answer by now. I too
stumbled upon this issue.

All I had to do is to add one more line
to startup.a51 code that was supplied by
Keil.

CSEG AT 0
?C_STARTUP: LJMP STARTUP1

RSEG ?C_C51STARTUP

STARTUP1:
; enable on-chip xdata RAM
MOV AUXR1,#00H ; AUXR1/Bit 1 (clear to 0 to enable on-chip XRAM)

This solved the problem.

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Keil logo

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.