User manual

276
mikoPascal PRO for PIC32
MikroElektronika
Inc(size);
UART1_Write(‘.’);
end;
end;
end;
//-------------- Main. Uncomment the function(s) to test the desired operation(s)
begin
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
begin
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.’);
end
else
begin
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;
end.