Datasheet
size : longint;
buffer : array[512] of byte;
//-------------- Writes string to USART
procedure Write_Str(var ostr: array[2] of byte);
var
i : byte;
begin
i := 0;
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'; // Set filename for single-file tests
Mmc_Fat_Assign(filename, 0xA0); // Will not find file and then
create file
Mmc_Fat_Rewrite; // To clear file and start with new data
for loop:=1 to 99 do // We want 5 files on the MMC card
begin
UART1_Write('.');
file_contents[0] := loop div 10 + 48;
file_contents[1] := loop mod 10 + 48;
Mmc_Fat_Write(file_contents, 42); // write data to the
assigned file
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
Mmc_Fat_Assign(filename, 0xA0); // find existing file or
create a new one
Mmc_Fat_Rewrite; // To clear file and start with new data
for loop := 1 to 44 do
begin
file_contents[0] := byte(loop div 10 + 48);
file_contents[1] := byte(loop mod 10 + 48);
end;
end;
289
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6