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

Скачать
Страница из 526
end if
next k
UART1_Write(13)
else
UART1_Write_Text("CID-error")
end if
i = Mmc_Read_Csd(data_for_registers)
if(i = 0) then
for k=0 to 15
printhex(data_for_registers[k])
if(k <> 15) then
UART1_Write("-")
end if
next K
UART1_Write(13)
UART1_Write(10)
else
UART1_Write_Text("CSD-error")
end if
{$ENDIF}
end.
Following example consists of several blocks that demonstrate various aspects of
usage of the Mmc_Fat16 library. These are:
- Creation of new file and writing down to it. 
- Opening existing file and re-writing it (writing from start-of-file). 
- Opening existing file and appending data to it (writing from end-of-file). 
- Opening a file and reading data from it (sending it to USART terminal). 
- Creating and modifying several files at once. 
Program MMC_FAT_Test
dim
Mmc_Chip_Select 
as sbit at PORTG.B1
Mmc_Chip_Select_Direction 
as sbit at DDRG.B1
dim
FAT_TXT 
as string[20]
file_contents 
as string[50]
filename 
as string[14] ' File names
character 
as byte
loop_, loop2 
as byte
size 
as longint
buffer 
as byte[512]
275
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6