User manual
340
mikoPascal PRO for PIC32
MikroElektronika
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;
// MMC module connections
var MMC_chip_select : sbit at LATG9_bit; // for writing to output pin always use latch
var MMC_chip_select_direction : sbit at TRISG9_bit;
// eof MMC module connections
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;
buffer : array[512] of byte;