Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

External Ram Accessing with keil c, using Winbond W77e58

Status
Not open for further replies.

ermtariq2

Newbie level 4
Joined
Sep 8, 2009
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Mumbai
Activity points
1,324
External Ram Accessing

Hi All,

Can any one help me How to read and write external ram with keil c, using Winbond W77e58.
Please dont go in hardware detail.
I am using C languag.
Thankyou
 

Re: External Ram Accessing

You need to declare the data as xdata.

example:
unsigned char xdata variable;

Also remember there is 1K of internal SRAM controlled by the DME0 bit in the PMR register. If this SRAM is enable, it is mapped to addresses 0x0000 to 0x03FF. Accesses outside this range will access external memory.
 

External Ram Accessing

hi itaig,

i suppose you are reply only write to RAM , can you reply how to read from ram.
 

Re: External Ram Accessing

Applies to both reading and writing.

Code:
char xdata x; // Variable in external memory
char a; // Normal variable
char b; // Normal variable

void test(void)
{
  x = a; // Writes a to external RAM
  b = x; // Reads from external RAM into b
  x ++; // Read from external RAM, add 1 then write back to external RAM
}
 

External Ram Accessing

Hi itaig ,
Thanks for reply......

I have two querstion...

1. Can I access external RAM without doing anything with internal RAM.
2. Does external memory varialbe(xdata) required memory location to access it .. or it can can be identify with its name...
 

Re: External Ram Accessing

Yes you can access just the external RAM and not use the internal xdata RAM.

The linker will automatically assign addresses to any variable that has the xdata attribute. You can assign an absolute address if you wish but generally you only need to do this if you have memory mapped I/O.

Aside from the declaration of the variable, you just treat it as you would any other variable, the compiler will work the rest out for you.
 

Hi guys,


Continue to the question. If I am using eeprom, can the same method applied? and can i output read value from P0?



Thank you!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top