Hi.
I have a feeling, Keil is using only lower 128Bytes Data space of my ADuC814. The ADuC manual says, it has a lower RAM (00H - 7FH), and upper RAM (80H - FFH). The upper RAM is addressable by indirect adressing. Can anyone write one line as example, how should I make it in C for Keil? Do I need to change any other seetings?
Look up the 'data' and 'idata' keywords in the manual...
http://www.keil.com/support/man/docs/c51/c51_le_memareas.htm http://www.keil.com/support/man/docs/c51/c51_le_memtypes.htm
"The upper RAM is addressable by indirect adressing"
To be precise, the "upper" RAM is addressable only by indirect adressing;
The "lower" RAM is addressable also by indirect adressing.
See: www.8052.com/tut8052.phtml
You probably also need to download & study a copy of the so-called "bible" for the 8051:
Chapter 1 - 80C51 Family Architecture: www.nxp.com/.../80C51_FAM_ARCH_1.pdf
Chapter 2 - 80C51 Family Programmer's Guide and Instruction Set: www.nxp.com/.../80C51_FAM_PROG_GUIDE_1.pdf
Chapter 3 - 80C51 Family Hardware Description: www.nxp.com/.../80C51_FAM_HARDWARE_1.pdf
Here are some other introductory & reference materials: http://www.keil.com/books/8051books.asp www.8052.com/books.phtml
... and also look up the various memory models while you're at it. You'll see that C51 will not use the upper 128 bytes of RAM unless you explicitly tell it to do so by using the idata specifier.
Thank you so much for your replies. You've been very helpful. The problem solved - instead of:
int i;
one should write:
int idata i;
and that's it.
before writing
for any memory space in an 8051, one should think very carefully about whether an 'int' is really needed - or will a 'char' do?
And should it be unsigned?
When running out of 'data' space do not willy-nilly change some variables to 'idata'. The access of an idata variable is slower than the access of a data variable
First check arrays (data/idata makes no difference unless addressed by fixed offsets). Then find some rarely used variables and change them. then ... well you should have gotten the drift by now.
Erik