User manual

mikroBasic PRO for PIC32
MikroElektronika
277
Delay_ms(1000)
UART1_Write(0x55)
end if
end sub
‘-------------- Tries to create a swap le, 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 function
for details
if (size <> 0) then
LongIntToStr(size, err_txt)
UART1_Write_Line(err_txt)
for i=0 to 4999
Cf_Write_Sector(size, Buffer)
Inc(size)
UART1_Write(“.”)
next i
end if
end sub
‘-------------- 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”
le_contents[LINE_LEN-2] = 13
le_contents[LINE_LEN-1] = 10
le_contents[LINE_LEN] = 0
lename = “MIKRO00xTXT”
#dene COMPLETE_EXAMPLE ‘ comment this line to make simpler/smaller example
CHECON = 0x32
AD1PCFG = 0xFFFF ‘ disable A/D inputs
‘ Initialize UART1 module
UART1_Init(56000)
Delay_ms(10)
UART1_Write_Line(“MCU-Started”) ‘ MCU 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