Hello All,

Could someone explain please how to use correctly SDFS.PBP include file in regards of correct handling file date. Everything seems to be working for me except of that when I create a file or open one for write, the date assigned to file (as I see it when then open the SD card on PC) is always 1992 instead of 2012, so I have to actually assign the value 12+20 in order to get 2012 when I then open card on Windows computer. The year is being read from RTCC which keeps two digits. I tried to set RTCC to 2020, 2039 year, etc. and if I add 20 before assigning this to the file date, everything seems to be working ok but I am not comfortable with this because I do not know why this happens

This is how I read RTCC:

READ_RTC:
I2CREAD RTCC_SDA, RTCC_SCL, RTC, SEC_REG, [sec,mins,hr,day,date,mon,yr]

...
YR_T = yr & %11110000
YR_T = YR_T>>4
YR_O = yr & %1111
YR_O = YR_O+10*YR_T 'here we must have 12 for this year
...

Than I record in file:

Gosub FSinit ' INIT card

ARRAYWRITE FAT_Filename, ["LOG TXT"]
' Set file time to CURRENT TIME and date
FAT_seconds = 0
FAT_minutes = MIN_O
FAT_hours = HR_O
FAT_day = DATE_O
FAT_month = MON_O
FAT_year = YR_O + 20 'HERE I HAVE TO ADD 20. NOT SURE WHY!

' Open a file for write
FAT_mode = "a" ' Append mode

Gosub FSfopen ' Open file pointed to by Byte array FAT_FileName

' Write to file
This way
' ARRAYWRITE FAT_src, [HEX2 DATE,"-", HEX2 MON,"-",HEX2 YR, ",", _
Or this way, no difference
ARRAYWRITE FAT_src, [HEX2 DATE,"-", HEX2 MON,"-",dec2 YR_o, ",", _
HEX2 HR, ":", HEX2 MINS,","]
FAT_count = 15
Gosub FSfwrite
...

Maybe zero year in FAT is 1980? same value appears as 1992 in file change date and as 12 in the record inside the file so it has to be incremented by 20 to become 2012 in the file time stamp

Please advise
Thank you very much!