Continue to Site

how to create file name on sd card with date info on it

Status
Not open for further replies.

pasicr

Advanced Member level 1
Advanced Member level 1
Joined
Aug 13, 2005
Messages
440
Helped
39
Reputation
80
Reaction score
29
Trophy points
1,308
Location
Macedonia
Visit site
Activity points
4,213
Hi there,
can you help me how to create file name on sd card with date info on it?
for example:
DDMMYY.TXT
I use DS1307 on PIC18,
regards
 

If you use mikroC PRO then you have function to create a new file. It uses a string variable for file name. If you set the string to DDMMYY\0 and use the string as filename for the file to be created then you will have what you want.
 
  • Like
Reactions: pasicr

    pasicr

    Points: 2
    Helpful Answer Positive Rating
Thanks Jayanth,
yes, I use mikroC Pro,
the part of code:
Code:
char filename[14] = "BROJAC0x.TXT";          // File names

// Creates new file and writes some data to it
void M_Create_New_File() {
  filename[7] = '1';
  Mmc_Fat_Set_File_Date(2013, 9, 21, 9, 0, 0); // Set file date & time info
  Mmc_Fat_Assign(&filename, 0xA0);          // Find existing file or create a new one
  Mmc_Fat_Rewrite();                        // To clear file and start with new data
....
}

On this way I create file name BROJAC01.TXT,
but I need date info on file name...
 


Code C - [expand]
1
2
3
4
5
6
7
filename[0] = day/10 + 48;
filename[1] = day%10 + 48;
filename[2] = month/10 + 48;
filename[3] = month%10 + 48;
filename[4] = year/10 + 48;
filename[5] = year%10 + 48;
filename[6] = '\0';



day, month, year are variables used in your RTC code.
 
  • Like
Reactions: pasicr

    pasicr

    Points: 2
    Helpful Answer Positive Rating
Jayanth, can you please explain in short about mean of
'\0'
'\t'
'\n'
'\r'
for strings commands using with SD card,
best regards
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top