ARM Technical Support Knowledge Articles

USING THE DS87C520 INTERNAL SRAM

Applies to: C51 C Compiler

Answer


Information in this article applies to:


SYMPTOMS

I'm using the on-chip SRAM (XDATA) of the Dallas Semiconductor 520. By default, this memory is disabled, so, in my main C function, I enable this memory:

sfr PMR = 0xC4;  // Power Management Register

void main (void)
{
PMR &= ~0x03;    // Clear DME0 and DME1
PMR |= 0x01;     // Set DME0...
}

However, my initialized variables don't seem to get set right. Weird things happen!!! Is there a trick to using the on-chip XDATA of the 520?

CAUSE

There is no trick to using the XDATA on this part. However, you must enable the on-chip memory BEFORE the startup code clears the memory and before global variables are initialized. The problems you are experiencing now are because the memory is enabled AFTER the startup code clears and initializes global variables.

RESOLUTION

To properly enable the on-chip SRAM, you must set the DME0 bit in the startup code. Refer to the lib directory for the STARTUP.A51 file. Copy it into your project directory, and make the following changes:

.
.
.

STARTUP1:
                ANL     0C4h, #0FCh    ; CLEAR DME0 & DME1
                ORL     0C4h, #01h     ; SET DME0
IF IDATALEN <> 0
.
.
.

This enables the on-chip XDATA before that memory is cleared and initialized.

MORE INFORMATION

For more information, refer to your Dallas Semiconductor databook.

Article last edited on: 2004-06-08 11:01:08

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