This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

8051 and external Flash memory using C?

Hi All,

I am trying to read and write to external memory.
and I want to read data from external memory and output to P0

now I have a few questions.

1. do I need to set the ALE, EA, RD, and WR bits?
2. Following is my code, and it seem not to do anything, something wrong?

main()
{ char xdata *a_Ptr=0x8000;
char myX;

while(1)
{ for(i=0;i<=15;i++)
{ myX=*a_Ptr;
P0=myX;
} }
}

since my external memory already has data in it, I added a loop to try to read the data and output from P0, but the output is not the data in the flash memory. instead, it output the numbers from 0 to 15. what could be the problem?

0