for (i=0;i<100;i++) //Before writing,send 100 clock to MMC/SD-Card
{
Read_Byte_MMC();
}
for(i=0; i<blocknum; i++)
{
Write_Byte_MMC(0xFC); //Send Start Byte to MMC/SD-Card
for (j=0;j<512;j++) //Now send real data Bolck (512Bytes)
{
Write_Byte_MMC(*Buffer++); //send 512 bytes to Card
}
Write_Byte_MMC(0xFF); //CRC
Write_Byte_MMC(0xFF); //CRC
while (Read_Byte_MMC()!=0xff){}; //Wait till MMC/SD-Card is not busy
}
Write_Byte_MMC(0xff); //
Write_Byte_MMC(0xfd); //发送数据停止令牌
while (Read_Byte_MMC()!=0xff){}; //Wait till MMC/SD-Card is not busy