User manual
276
mikoBasic PRO for PIC32
MikroElektronika
end sub
‘-------------- Deletes a le. If le doesn’t exist, it will rst be created
‘ and then deleted.
sub procedure M_Delete_File()
lename[7] = “F”
Cf_Fat_Assign(lename, 0)
Cf_Fat_Delete()
end sub
‘-------------- Tests whether le exists, and if so sends its creation date
‘ and le size via USART
sub procedure M_Test_File_Exist()
dim
fsize as longint
year as word
month_, day, hour_, minute_ as byte
outstr as char[12]
lename[7] = “B” ‘ uncomment this line to search for le that DOES exists
‘ lename[7] = “F” ‘ uncomment this line to search for le that DOES NOT exist
if Cf_Fat_Assign(lename, 0) <> 0 then
‘--- le has been found - get its date
Cf_Fat_Get_File_Date(year,month_,day,hour_,minute_)
UART1_Write_Text(“ created: “)
WordToStr(year, outstr)
UART1_Write_Text(outstr)
ByteToStr(month_, outstr)
UART1_Write_Text(outstr)
WordToStr(day, outstr)
UART1_Write_Text(outstr)
WordToStr(hour_, outstr)
UART1_Write_Text(outstr)
WordToStr(minute_, outstr)
UART1_Write_Text(outstr)
‘--- le has been found - get its modied date
Cf_Fat_Get_File_Date_Modied(year, month_, day, hour_, minute_)
UART1_Write_Text(“ modied: “)
WordToStr(year, outstr)
UART1_Write_Text(outstr)
ByteToStr(month_, outstr)
UART1_Write_Text(outstr)
WordToStr(day, outstr)
UART1_Write_Text(outstr)
WordToStr(hour_, outstr)
UART1_Write_Text(outstr)
WordToStr(minute_, outstr)
UART1_Write_Text(outstr)
‘--- get le size
fsize = Cf_Fat_Get_File_Size
LongIntToStr(fsize, outstr)
UART1_Write_Line(outstr)
else
‘--- le was not found - signal it
UART1_Write(0x55)