Datasheet
// sectors (see Help for details)
procedure M_Create_Swap_File;
var i : word;
begin
for i:=0 to 511 do
Buffer[i] := i;
size := Cf_Fat_Get_Swap_File(5000, 'mikroE.txt', 0x20); // see
help on this function for details
if (size <> 0) then
begin
LongIntToStr(size, fat_txt);
Write_Str(fat_txt);
for i:=0 to 4999 do
begin
Cf_Write_Sector(size, Buffer);
size := size+1;
UART1_Write('.');
end;
end;
end;
//-------------- Main. Uncomment the function(s) to test the desired
operation(s)
begin
FAT_TXT := 'FAT16 not found';
file_contents := 'XX CF FAT16 library by Anton Rieckert';
file_contents[37] := 10; // newline
filename := 'MIKRO00xTXT';
// we will use PORTC to signal test end
DDRC := 0xFF;
PORTC := 0;
UART1_Init(19200); // Set up USART for file reading
delay_ms(100);
UART1_Write_Text(':Start:');
// --- Init the FAT library
// --- use Cf_Fat_QuickFormat instead of init routine if a for-
mat is needed
if Cf_Fat_Init() = 0 then
begin
//--- test functions
//----- test group #1
Open_File_Read();
224
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6