User manual
350
mikoBasic 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
dim size as longword
...
size = Mmc_Fat_Get_Swap_File(1000, “mikroE.txt”, 0x20)
if (size <> 0) then
UART1_Write(0xAA)
UART1_Write(Lo(size))
UART1_Write(Hi(size))
UART1_Write(Higher(size))
UART1_Write(Highest(size))
UART1_Write(0xAA)
end if
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
dim MMC_chip_select as sbit at LATG9_bit ‘ for writing to output pin always use latch
dim MMC_chip_select_direction as sbit at TRISG9_bit
‘ eof MMC module connections
const LINE_LEN = 43
dim
FAT_TXT as string[20]
le_contents as string[LINE_LEN]
lename as string[14] ‘ File names
character as byte
loop_, loop2 as byte
size as longint
buffer as byte[512]