Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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

Status
Not open for further replies.

pasicr

Advanced Member level 1
Joined
Aug 13, 2005
Messages
440
Helped
39
Reputation
80
Reaction score
29
Trophy points
1,308
Location
Macedonia
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
Great, it's work,
thanks again,
best regards
 

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