Mikroelektronika MIKROE-442 데이터 시트
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
403
Example
‘-------------- Try to create a swap file 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 file and writing down to it;
- Opening existing file and re-writing it (writing from start-of-file);
- Opening existing file and appending data to it (writing from end-of-file);
- Opening a file and reading data from it (sending it to UART terminal);
- Creating and modifying several files at once;
- Reading file contents;
- Deleting file(s);
- Creating the swap file (see Help for details);
Copy Code To Clipboard
program MMC_FAT_Test
dim
Mmc_Chip_Select as sbit at LATF0_bit ‘ for writing to output pin always use latch
(PIC18 family)
Mmc_Chip_Select_Direction as sbit at TRISF0_bit
const LINE_LEN = 43
dim
err_txt as string[20]
file_contents as string[LINE_LEN]
filename as string[14] ‘ File names
character as byte
loop1, loop2 as byte
size as longint
buffer as byte[512]