SD卡读取的数据有丢失,这是怎么回事?请有经验的兄弟帮我分析下,谢谢!
[复制链接]
以下是我的主函数的一部分:
while(1) { //先把要写的数据存入到数组sample里,c初始值为0x0001 for (i = 0; i < 128; i++) { sample[j++]=c++; sample[j++]=c++; sample[j++]=c++; sample[j++]=c++; } printf(" write sample\n"); for(k=0;k<512;k++) printf ("%bx\t",sample[k]);/显示要存储的数据 data_tst=sample; Laddr=5960;//打算存储的块地址 printf("begin to write\n"); Write_SD_Card(Laddr,data_tst);//写函数 printf("write is completed\n");//写完成 for(k=0;k<512;k++) {sample[k]=0;}//将数组清零,为下一步读取做准备(读取的数据同样放到该数组中)
printf("begin to read\n"); Read_SD_Card(Laddr, data_tst);//读块数据 printf("read data\n"); for(b=0;b<512;b++) printf("%bx\t",sample);//输出读取的数据
|