User manual

mikroPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
401
Example
//-------------- Try to create a swap le with archive atribute, whose size
will be at least 1000 sectors.
// If it succeeds, it sends No. of start sector over UART
var size : dword;
...
size := Mmc_Fat_Get_Swap_File(1000, ‘mikroE.txt’, 0x20);
if (size <> 0) then
begin
UART1_Write(0xAA);
UART1_Write(Lo(size));
UART1_Write(Hi(size));
UART1_Write(Higher(size));
UART1_Write(Highest(size));
UART1_Write(0xAA);
end;
Notes Long File Names (LFN) are not supported.
Library Example
This project consists of several blocks that demonstrate various aspects of usage of the Mmc_Fat16 library. These
are:
- Creation of new le and writing down to it;
- Opening existing le and re-writing it (writing from start-of-le);
- Opening existing le and appending data to it (writing from end-of-le);
- Opening a le and reading data from it (sending it to UART terminal);
- Creating and modifying several les at once;
- Reading le contents;
- Deleting le(s);
- Creating the swap le (see Help for details);
Copy Code To Clipboard
program MMC_FAT_Test;
var
Mmc_Chip_Select : sbit at LATF0_bit; // for writing to output pin always use latch
(PIC18 family)
Mmc_Chip_Select_Direction : sbit at TRISF0_bit;
const LINE_LEN = 43;
var
err_txt : string[20];
le_contents : string[LINE_LEN];
lename : string[14]; // File names
character : byte;
loop, loop2 : byte;
size : longint;