User manual

296
mikoPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
if (size <> 0) then
begin
LongIntToStr(size, err_txt);
UART1_Write_Line(err_txt);
for i:=0 to 4999 do
begin
Cf_Write_Sector(size, Buffer);
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’;
lename := ‘MIKRO00xTXT’;
{$dene 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
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.