我用2808读取TF卡,初始化成功了,但是读取不对。我测了一下,返回值就不对。
请高手指教,谢谢!
以下为读取程序:
//=======================================================================
//从SD卡指定地址读取数据,一次最多512字节
unsigned char SdReadBlock(unsigned char *Block, unsigned long shanqu,int len)
{
unsigned int count;
unsigned long address=shanqu*512;
SD_CS_L;
//DELAY_US(10);
//DelayMs(1000);
SdCommand(0x11,address,0xff);
if(SdResponse()==0x00)
{
while(SdRead()!=0xfe);//接收数据令牌!卡在这里了!
for(count=0;count<len;count++) *Block++=SdRead();
for(;count<512;count++) SdRead();
SdRead();
SdRead();
SD_CS_H;
//DELAY_US(10);
//DelayMs(1000);
SdRead();
return 1;
}
return 0;
}
|