Datasheet

printhex(data_for_registers[k]);
if(k <> 15) then
UART1_Write('-');
end;
UART1_Write(13);
end
else
begin
UART1_Write_Text('CID-error');
end;
i := Mmc_Read_Csd(data_for_registers);
if(i = 0) then
begin
for k:=0 to 15 do
begin
printhex(data_for_registers[k]);
if(k <> 15) then
UART1_Write('-');
end;
UART1_Write(13);
UART1_Write(10);
end
else
begin
UART1_Write_Text('CSD-error');
end;
{$ENDIF}
end.
Next example consists of several blocks that demonstrate various aspects of usage
of the Mmc_Fat16 library, creation of new file and writing down to it, opening exist-
ing file and re-writing it, opening existing file and appending data to it, opening a file
and reading data it, creating and modifying several files at once, reading file con-
tents, deleting file(s) and creating the swap file.
Program MMC_FAT_Test;
var
Mmc_Chip_Select : sbit at PORTG.B1;
Mmc_Chip_Select_Direction : sbit at DDRG.B1;
var
FAT_TXT : string[20];
file_contents : string[50];
filename : string[14]; // File names
character : byte;
loop, loop2 : byte;
288
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6