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

writing and reading in external Ram (CompactFlash) NOK

Hi,

I have already post a thread (http://www.keil.com/forum/docs/thread9212.asp)

So again I can't still communicate with my CF
I wrote this code :

unsigned char volatile xdata CF_SECTOR_COUNT _at_ 0x09F2 ;
unsigned char volatile xdata device_10 _at_ 0x8000 ;
unsigned char volatile xdata device_11 _at_ 0x8001 ;

AUXR = 0x0D;

AUXR |= 0x8D ;
for(j=0;j<255;j++)
{
                printf("write:-[%d]\n",j);
        P5_2 = 0x00; //CSO  for writing in first RAM
        P5_3 = 0x01; //CS1


        for(k=0;k<300;k++); //waiting time
        CF_SECTOR_COUNT=j;
         for(k=0;k<300;k++); //waiting time
         device_10=j;
         for(k=0;k<300;k++); //waiting time
        device_11=0x0C;


        P5_2 = 0x01; //CSO
        P5_3 = 0x01; //CS1

         for(k=0;k<800;k++);

        P5_2 = 0x00; //CSO
        P5_3 = 0x01; //CS1
        for(k=0;k<800;k++);

printf("CF_SEC = [%X] : d10 = [%X] : d11 = [%X]\n",CF_SECTOR_COUNT,device_10,device_11);

         P5_2 = 0x01; //CSO
         P5_3 = 0x01; //CS1

}

Results:
...
write:-[16]
CF_SEC = [FFFF] : d10 = [FF20] : d11 = [3B00]
write:-[17]
CF_SEC = [FFFF] : d10 = [FF20] : d11 = [3B00]
write:-[18]
....

But when I execute this code it gives me the same results with card CF or without card CF.

Is this a software problem ? Can you help me please?

0