//SD卡初始化
char SD_init(void)
{
int i;
int time=5;
unsigned char response1=0xff,response2=0xff;
P5SEL|=0X0e; //初始化430UART引脚
P5DIR|=0X0B;
SPI_init();
CS_1;
do
{
if(!time)
return (failed);
time--;
for(i=0;i<10;i++)
Sendbyte(0xff);//延时80个CLK
CS_0;
Sendcmd(cmd0,0,0x95);
}
while(getresponse1()!=0x01);
while((response1!=0x01)||(response2!=0x00))
{
CS_1;
Sendbyte(0xff);//延时8个CLK
CS_0;
Sendcmd(cmd55,0,0xff);
response1=getresponse1();
CS_1;
Sendbyte(0xff);
CS_0;
Sendcmd(acmd41,0,0xff);
response2=getresponse0();
}
CS_1;
Sendbyte(0xff);
return (SUCCESS);
}
刚开始做430,要做个SPI方式写SD卡的程序,大侠们帮帮忙看看吧。。。这个问题已经纠结好久了
,看了很多资料也没明白为什么循环不出来
此帖出自
小平头技术问答
一周热门 更多>