Datasheet
while ostr[i] <> 0 do begin
UART1_Write(ostr[i]);
Inc(i);
end;
UART1_Write($0A);
end;
//-------------- Creates new file and writes some data to it
procedure Create_New_File;
begin
filename[7] := 'A';
Cf_Fat_Assign(filename, 0xA0); // Will not find file and then
create file
Cf_Fat_Rewrite(); // To clear file and start with new data
for loop:=1 to 90 do // We want 5 files on the MMC card
begin
PORTC := loop;
file_contents[0] := loop div 10 + 48;
file_contents[1] := loop mod 10 + 48;
Cf_Fat_Write(file_contents, 38); // write data to the assigned file
UART1_Write('.');
end;
end;
//-------------- Creates many new files and writes data to them
procedure Create_Multiple_Files;
begin
for loop2 := 'B' to 'Z' do
begin
UART1_Write(loop2); // this line can slow down the performance
filename[7] := loop2; // set filename
Cf_Fat_Assign(filename, 0xA0); // find existing file or
create a new one
Cf_Fat_Rewrite; // To clear file and start with new data
for loop := 1 to 44 do
begin
file_contents[0] := loop div 10 + 48;
file_contents[1] := loop mod 10 + 48;
Cf_Fat_Write(file_contents, 38); // write data to the
assigned file
end;
end;
end;
//-------------- Opens an existing file and rewrites it
procedure Open_File_Rewrite;
begin
filename[7] := 'C'; // Set filename for single-file tests
Cf_Fat_Assign(filename, 0);
Cf_Fat_Rewrite;
221
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6