Hello! How to get a list of files on a microsd card. I've tried using functions: Mmc_Fat_Dir and Mmc_Fat_ReadDir, but I still don't understand how to work with them.
Thank you in advance
MicroSD card
Re: MicroSD card
Hello Sergej,
what is your problem?
Mmc_Fat_Dir comes later, first recognizing and initializing the SD card. Is that possible? what is the memory size of the card? Which MC? The ME-Libs only make FAT16, so only suitable for small memories.
A long time ago I tried something with an SD card, attached
With regards
Peter
what is your problem?
Mmc_Fat_Dir comes later, first recognizing and initializing the SD card. Is that possible? what is the memory size of the card? Which MC? The ME-Libs only make FAT16, so only suitable for small memories.
A long time ago I tried something with an SD card, attached
With regards
Peter
- Attachments
-
- Demo_SDIO.zip
- (8.5 KiB) Downloaded 66 times
Re: MicroSD card
Hello Pelikan!
the memory card was initialized in SPI mode. The memory capacity is 2 GB. I need to get a list of files that are on this memory card and display them. Maybe you need to use the FAT32 library?
the memory card was initialized in SPI mode. The memory capacity is 2 GB. I need to get a list of files that are on this memory card and display them. Maybe you need to use the FAT32 library?
- stefan.filipovic
- mikroElektronika team
- Posts: 1135
- Joined: 18 Dec 2018 10:30
Re: MicroSD card
Hi,
Mmc_Fat_Dir routine displays the contents of the current directory via a user-defined medium (i.e. UART module, a file on the FAT16 file system). The function displays character by character.
Parameters - print: ^TProcedure - function pointer to a routine which will display contents of the current directory.
The routine should be defined as below.
Now just call the following line from the main routine:
Kind regards,
Mmc_Fat_Dir routine displays the contents of the current directory via a user-defined medium (i.e. UART module, a file on the FAT16 file system). The function displays character by character.
Parameters - print: ^TProcedure - function pointer to a routine which will display contents of the current directory.
The routine should be defined as below.
Code: Select all
// Displaying routine
procedure PrintChar(ch : byte);
begin
UART1_Write(ch);
end;
Code: Select all
Mmc_Fat_Dir(@PrintChar);
Stefan Filipović
Re: MicroSD card
This was my mistakestefan.filipovic wrote: ↑14 Sep 2020 11:55Hi,
Mmc_Fat_Dir routine displays the contents of the current directory via a user-defined medium (i.e. UART module, a file on the FAT16 file system). The function displays character by character.
Parameters - print: ^TProcedure - function pointer to a routine which will display contents of the current directory.
The routine should be defined as below.Now just call the following line from the main routine:Code: Select all
// Displaying routine procedure PrintChar(ch : byte); begin UART1_Write(ch); end;
Kind regards,Code: Select all
Mmc_Fat_Dir(@PrintChar);
- Attachments
-
- 111.png (13.15 KiB) Viewed 2309 times
Re: MicroSD card
HI!
How to use the Mmc_Fat_ReadDir function?
I tried to do as it is written in the help file, but the compiler gives an bug.
Incompatible types ("array" to "record") MMC_Fat16_Test.mpas
Then I tried to do it in a different way
But still nothing is written to this variable
How to use the Mmc_Fat_ReadDir function?
I tried to do as it is written in the help file, but the compiler gives an bug.
Code: Select all
if (1 = Mmc_Fat_ReadDir('DIR_A')) then
begin
...
end;
Then I tried to do it in a different way
Code: Select all
var dir_info: F16_DIR;
....
if (1 = Mmc_Fat_ReadDir(dir_info)) then
begin
...
end;
Re: MicroSD card
I liked the FAT32 library better. I was able to get a list of files on the memory card
Attention! Before using this library, the memory card must be formatted in FAT32 format
Code: Select all
var Dir_Info: __DIR;
...
SSD1306_Init(400000,1);
SSD1306_Fill($00);
SSD1306_Set_Font(@SSD1306_F5x7,6,7,32);
initSPI();
info:=FAT32_Init;
if info = 0 then SSD1306_Draw_String(0,0,0,'MSD_FAT32 Init OK')
else SSD1306_Draw_String(0,0,0,'MSD_FAT32 Init Error');
initFastSPI();
Dir_Name:='\';
FAT32_ChangeDir(@Dir_Name);
info:=FAT32_FindFirst(@Dir_Info);
if info = 1 then SSD1306_Draw_String(0,1,0, Dir_Info.NameExt);
repeat
info:=FAT32_FindNext(@Dir_Info);
Inc(cn);
if info = 1 then SSD1306_Draw_String(0,cn,0, Dir_Info.NameExt);
until info <> 1;