PDA

View Full Version : SD Card Write/Read



Ioannis
- 13th April 2014, 12:25
I am experimenting with the SD CARD topic on a 18F45K22 chip.

1. How is the variable FAT_year handled? With a value of 28 it creates a file of the year 2008. If I wanted a 2014 and set FAT_year to 214, it then creates a file in year 2066

2. Regarding the use of greater that 2GB cards (they are hard to find or expensive...), is there a reliable solution yet?

Thanks
Ioannis

xapmanis
- 28th April 2014, 06:26
1. How is the variable FAT_year handled? With a value of 28 it creates a file of the year 2008. If I wanted a 2014 and set FAT_year to 214, it then creates a file in year 2066
Ioannis

DIR_CrtDate = FAT_day | (FAT_month << 5) | (FAT_year << 9) ' Creation date

DIR_WrtDate = FAT_day | (FAT_month << 5) | (FAT_year << 9) ' Write date.

This exists in the sdfs.pbp file ioannis, And i think it's the formula that creates the date. I hope it can help you.

Ioannis
- 28th April 2014, 08:26
Hi.

Darrel has replied in the other forum. It is more easy than it looks.

The FAT system, starts the year counting from 1980. So, for 2014 all you have to do is 2014-1980=34. Place in the variable FAT_year the value 34 and you 'll be OK.

Ioannis