If the String_filename = "Istec" + ".txt" + "Date_time"
And this is placed in FAT16 Create File.
How to activate date and time, and where to fil in?
DS1307 works wel in my software.
C++ index FAT16 Create File show MX_FILE_CREATETIME
How to turn this in a String command?
MMC date and time
Moderator: Benj
-
- Flowcode V4 User
- Posts: 2
- Joined: Wed Dec 01, 2010 7:54 am
- Location: netherlands
- Contact:
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: MMC date and time
Hello,
The current FAT component hard codes the file creation time and date as the compilation time and date.
To get around this you will have to edit the create file routine using code customization.
In the Create file function you will see the following section of code.
Where CREATEDATE is the hard coded date and CREATETIME is the hard coded time.
You could replace the hard coded definitions with variables from Flowcode. eg a variable called time in Flowcode would be called FCV_TIME in the C code.
From doing a Google search of the FAT format I have come up with this bit of info regarding the date and time parameters.
Time (5/6/5 bits, for hour/minutes/doubleseconds)
Date (7/4/5 bits, for year-since-1980/month/day)
Both time and date will have to be INT type variables in Flowcode.
Let me know how you get on.
The current FAT component hard codes the file creation time and date as the compilation time and date.
To get around this you will have to edit the create file routine using code customization.
In the Create file function you will see the following section of code.
Code: Select all
Write_Byte_To_Buffer((i * 32) + 11, 0x20); //File Attribute
Write_Byte_To_Buffer((i * 32) + 12, 0x18); //Reserved for NT
Write_Byte_To_Buffer((i * 32) + 13, 0); //Creation time
Write_Byte_To_Buffer((i * 32) + 14, MX_FILE_CREATETIME);
Write_Byte_To_Buffer((i * 32) + 15, MX_FILE_CREATETIME >> 8);
Write_Byte_To_Buffer((i * 32) + 16, MX_FILE_CREATEDATE); //Creation date
Write_Byte_To_Buffer((i * 32) + 17, MX_FILE_CREATEDATE >> 8);
Write_Byte_To_Buffer((i * 32) + 18, MX_FILE_CREATEDATE); //Access date
Write_Byte_To_Buffer((i * 32) + 19, MX_FILE_CREATEDATE >> 8);
Write_Byte_To_Buffer((i * 32) + 20, 0x00);
Write_Byte_To_Buffer((i * 32) + 21, 0x00);
Write_Byte_To_Buffer((i * 32) + 22, MX_FILE_CREATETIME); //Modified time 0 no modification entry
Write_Byte_To_Buffer((i * 32) + 23, MX_FILE_CREATETIME >> 8);
Write_Byte_To_Buffer((i * 32) + 24, MX_FILE_CREATEDATE); //Modified date
Write_Byte_To_Buffer((i * 32) + 25, MX_FILE_CREATEDATE >> 8);
You could replace the hard coded definitions with variables from Flowcode. eg a variable called time in Flowcode would be called FCV_TIME in the C code.
From doing a Google search of the FAT format I have come up with this bit of info regarding the date and time parameters.
Time (5/6/5 bits, for hour/minutes/doubleseconds)
Date (7/4/5 bits, for year-since-1980/month/day)
Both time and date will have to be INT type variables in Flowcode.
Let me know how you get on.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode V4 User
- Posts: 2
- Joined: Wed Dec 01, 2010 7:54 am
- Location: netherlands
- Contact:
Re: MMC date and time
Hello,
Time and date still dont work.
To vill in the variable use box FAT Create lile and take ,, Temp16.AsInt = %a_FILE_CREATEDATE;,,
What to use =FILE_CREATEDATE or CREATEDATE or DATE.
How to put it in a C box.
Do you know the ansher..
Greatings ruud
Time and date still dont work.
To vill in the variable use box FAT Create lile and take ,, Temp16.AsInt = %a_FILE_CREATEDATE;,,
What to use =FILE_CREATEDATE or CREATEDATE or DATE.
How to put it in a C box.
Do you know the ansher..
Greatings ruud
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: MMC date and time
Hello,
If the time and date are flat out not giving valid values then I would advise using the custom code to switch this code in the defines section.
Change
To this.
Once you have done this the fixed time and date should work.
If you then need to change the time and date then you can do so by changing the code above to this.
You can then reference the time and date variables in Flowcode using a C icon.
Firstly compile to C and have a look at the output C file to see what %a is being passed through as. Then use this in your C icon.
Here is an example of the C code in a Flowcode C icon referencing Flowcode variables datevar and timevar.
If the time and date are flat out not giving valid values then I would advise using the custom code to switch this code in the defines section.
Change
Code: Select all
#define %a_FILE_CREATEDATE %l
#define %a_FILE_CREATETIME %k
Code: Select all
#define %a_FILE_CREATEDATE %k
#define %a_FILE_CREATETIME %l
If you then need to change the time and date then you can do so by changing the code above to this.
Code: Select all
MX_UINT16 %a_FILE_CREATEDATE %k
MX_UINT16 %a_FILE_CREATETIME %l
Firstly compile to C and have a look at the output C file to see what %a is being passed through as. Then use this in your C icon.
Here is an example of the C code in a Flowcode C icon referencing Flowcode variables datevar and timevar.
Code: Select all
FAT_1_FILE_CREATEDATE = FCV_DATEVAR;
FAT_1_FILE_CREATETIME = FCV_TIMEVAR;
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel