Looking to create the Fat file system Dword value from the current date & time returned from a DS1307 Clock.
Why you may well ask.
Am testing a uAlfat-TF device. This is GHI Electronics' competition to the VDrive2.
After a few initial hiccups it is currently writing continuously to a file on a microSD (or TransFlash) card using Hi2c. Found issues with hSPI.
Filename is being created from the date&time which is straightforward.
However the uAlFat system has a built in clock to create file date/timestamps used by the FAT file system. So the clock has to be set in that system as well - real friendly!
The information given is as follows;
Time and Date structure is a DWORD Standard structure in FAT system
Bits(s) Field Description
31..25 Year Years since 1980
24..21 Month 1..12
20..16 Day 1..31
15..11 Hour 0..23
10..5 Minute 0..59
4..0 Second Seconds divided by 2
The set Date Time data has to be sent in the form ddddtttt.
The example given is the date time value of 1/1/2006 00:00:00 is written as 34210000.
The DS1307 returns the time data in BCD which is currently converted with the bcdtoascii function
However to get the DWORD format the YMD data has to be converted into one word and the HMS data into another.
My research on FAT file systems indicates that the individual values can be converted to hex then added together to get the word values.
I have not found a way to do this in PICAXE Integer math and am hoping some of you math gurus might help.
Thanks
Why you may well ask.
Am testing a uAlfat-TF device. This is GHI Electronics' competition to the VDrive2.
After a few initial hiccups it is currently writing continuously to a file on a microSD (or TransFlash) card using Hi2c. Found issues with hSPI.
Filename is being created from the date&time which is straightforward.
However the uAlFat system has a built in clock to create file date/timestamps used by the FAT file system. So the clock has to be set in that system as well - real friendly!
The information given is as follows;
Time and Date structure is a DWORD Standard structure in FAT system
Bits(s) Field Description
31..25 Year Years since 1980
24..21 Month 1..12
20..16 Day 1..31
15..11 Hour 0..23
10..5 Minute 0..59
4..0 Second Seconds divided by 2
The set Date Time data has to be sent in the form ddddtttt.
The example given is the date time value of 1/1/2006 00:00:00 is written as 34210000.
The DS1307 returns the time data in BCD which is currently converted with the bcdtoascii function
However to get the DWORD format the YMD data has to be converted into one word and the HMS data into another.
My research on FAT file systems indicates that the individual values can be converted to hex then added together to get the word values.
I have not found a way to do this in PICAXE Integer math and am hoping some of you math gurus might help.
Thanks