User manual
298
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
‘-------------- Main. Uncomment the function(s) to test the desired operation(s)
main:
err_txt = “FAT16 not found”
le_contents = “XX CF FAT16 library by Anton Rieckert”
lename = “MIKRO00xTXT”
#dene COMPLETE_EXAMPLE ‘ comment this line to make simpler/smaller example
ADPCFG = 0xFFFF ‘ disable A/D inputs
‘ Initialize UART1 module
UART1_Init(19200)
Delay_ms(10)
UART1_Write_Line(“dsPIC-Started”) ‘ dsPIC present report
‘ --- Init the FAT library
‘ --- use Cf_Fat_QuickFormat instead of init routine if a format is needed
if Cf_Fat_Init() = 0 then
Delay_ms(2000) ‘ wait for a while until the card is stabilized
‘ period depends on used CF card
‘--- Test start
UART1_Write_Line(“Test Start.”)
M_Create_New_File()
#IFDEF COMPLETE_EXAMPLE
M_Create_Multiple_Files()
M_Open_File_Rewrite()
M_Open_File_Append()
M_Open_File_Read()
M_Delete_File()
M_Test_File_Exist()
M_Create_Swap_File()
#ENDIF
UART1_Write_Line(“Test End.”)
else
UART1_Write_Line(err_txt) ‘ Note: Cf_Fat_Init tries to initialize a card more
than once.
‘ If card is not present, initialization may last
longer (depending on clock speed)
end if
end.