Datasheet

#ifdef RS232_debug
UART1_Write_Text("PIC-Started"); // If PIC present report
UART1_Write(13);
UART1_Write(10);
#endif
// Before all, we must initialize a MMC card
SPI1_Init_Advanced(_SPI_MASTER, _SPI_FCY_DIV2, _SPI_CLK_LO_LEAD-
ING);
Spi_Rd_Ptr = SPI1_Read;
i = Mmc_Init();
#ifdef RS232_debug
if(i == 0)
{
UART1_Write_Text("MMC Init-OK"); // If MMC present report
UART1_Write(13);
UART1_Write(10);
}
if(i)
{
UART1_Write_Text("MMC Init-error"); // If error report
UART1_Write(13);
UART1_Write(10);
}
#endif
for(i=0; i<=511; i++)
dData[i] = 'E'; // Fill MMC buffer with same characters
i = Mmc_Write_Sector(55, dData);
#ifdef RS232_debug
if(i == 0)
{
UART1_Write_Text("Write-OK");
}
else // if there are errors.....
{
UART1_Write_Text("Write-Error");
}
UART1_Write(13);
UART1_Write(10);
#endif
// Reading of CID and CSD register on MMC card.....
#ifdef RS232_debug
i = Mmc_Read_Cid(data_for_registers);
if(i == 0)
{
for(k=0; k<=15; k++)
{
printhex(data_for_registers[k]);
if(k!=15) UART1_Write('-');
}
337
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6