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
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.
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
}
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...
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.