Техническая Спецификация для Mikroelektronika MIKROE-350

Скачать
Страница из 526
{$IFDEF RS232_debug}
UART1_Write_Text("AVR-Started") ' If AVR present report
UART1_Write(13)
UART1_Write(10)
{$ENDIF}
' Beffore all, we must initialise a MMC card
SPI1_Init_Advanced(_SPI_MASTER, _SPI_FCY_DIV2, _SPI_CLK_LO_LEAD-
ING)
Spi_Rd_Ptr = @SPI1_Read
i = Mmc_Init()
PORTC = i
{$IFDEF RS232_debug}
if(i = 0) then
UART1_Write_Text("MMC Init-OK") ' If MMC present report
UART1_Write(13)
UART1_Write(10)
end if
if
(i) then
UART1_Write_Text("MMC Init-error") ' If error report
UART1_Write(13)
UART1_Write(10)
end if
{$ENDIF}
for i=0 to 511
dData[i] = "E" ' Fill MMC buffer with same characters
next i
i = Mmc_Write_Sector(55, dData)
{$IFDEF RS232_debug}
if(i = 0) then
UART1_Write_Text("Write-OK")
else
' if there are errors.....
UART1_Write_Text("Write-Error")
end if
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) then
for k=0 to 15
printhex(data_for_registers[k])
if(k <> 15) then
UART1_Write("-")
274
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6