Datasheet

// and then deleted.
procedure Delete_File;
begin
filename[7] := 'F';
Cf_Fat_Assign(filename, 0);
Cf_Fat_Delete;
end;
//-------------- Tests whether file exists, and if so sends its cre-
ation date
// and file size via USART
procedure Test_File_Exist(fname : byte);
var
fsize: longint;
year: word;
month, day, hour, minute: byte;
outstr: array[12] of byte;
begin
filename[7] := 'B'; //uncomment this line to search for
file that DOES exists
// filename[7] := 'F'; //uncomment this line to search for
file that DOES NOT exist
if Cf_Fat_Assign(filename, 0) <> 0 then begin
//--- file has been found - get its date
Cf_Fat_Get_File_Date(year,month,day,hour,minute);
WordToStr(year, outstr);
Write_Str(outstr);
ByteToStr(month, outstr);
Write_Str(outstr);
WordToStr(day, outstr);
Write_Str(outstr);
WordToStr(hour, outstr);
Write_Str(outstr);
WordToStr(minute, outstr);
Write_Str(outstr);
//--- get file size
fsize := Cf_Fat_Get_File_Size;
LongIntToStr(fsize, outstr);
Write_Str(outstr);
end
else begin
//--- file was not found - signal it
UART1_Write(0x55);
Delay_ms(1000);
UART1_Write(0x55);
end;
end;
//-------------- Tries to create a swap file, whose size will be at
least 100
223
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6