Datasheet

sub procedure Test_File_Exist(dim fname as byte)
dim
fsize as longint
year as word
month_, day, hour_, minute_ as byte
outstr as byte[12]
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
'--- 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)
else
'--- file was not found - signal it
UART1_Write(0x55)
Delay_ms(1000)
UART1_Write(0x55)
end if
end sub'~
'-------------- Tries to create a swap file, whose size will be at
least 100
' sectors (see Help for details)
sub procedure M_Create_Swap_File
dim i as word
for i=0 to 511
Buffer[i] = i
next i
size = Cf_Fat_Get_Swap_File(5000, "mikroE.txt", 0x20) ' see
help on this sub function for details
if (size <> 0) then
208
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6