fatfs文件创建时间怎么添加
答案:1 悬赏:20 手机版
解决时间 2021-01-25 21:53
- 提问者网友:沦陷
- 2021-01-25 15:32
fatfs文件创建时间怎么添加
最佳答案
- 五星知识达人网友:轻雾山林
- 2021-01-25 16:51
这样写
DWORD get_fattime(void)
{
DWORD time_buff=0;
PCF8563_ReadWrite_Time(1); //获取时间信息
//将时间十六进制转换成BCD码
TimeValue.year = HX_to_DX(TimeValue.year); //年
TimeValue.month = HEX_to_BCD(TimeValue.month); //月
TimeValue.date = HEX_to_BCD(TimeValue.date); //日
TimeValue.hour = HEX_to_BCD(TimeValue.hour); //时
TimeValue.minute = HEX_to_BCD(TimeValue.minute);//分
TimeValue.second = HEX_to_BCD(TimeValue.second);//秒
//按照FatFs的时间格式组合
time_buff |= ((TimeValue.year - 1980)<<25); //年
time_buff |= (TimeValue.month<<21); //月
time_buff |= (TimeValue.date<<16); //日
time_buff |= (TimeValue.hour<<11); //时
time_buff |= (TimeValue.minute<<5); //分
time_buff |= (TimeValue.second/2); //秒
return time_buff;
}
DWORD get_fattime(void)
{
DWORD time_buff=0;
PCF8563_ReadWrite_Time(1); //获取时间信息
//将时间十六进制转换成BCD码
TimeValue.year = HX_to_DX(TimeValue.year); //年
TimeValue.month = HEX_to_BCD(TimeValue.month); //月
TimeValue.date = HEX_to_BCD(TimeValue.date); //日
TimeValue.hour = HEX_to_BCD(TimeValue.hour); //时
TimeValue.minute = HEX_to_BCD(TimeValue.minute);//分
TimeValue.second = HEX_to_BCD(TimeValue.second);//秒
//按照FatFs的时间格式组合
time_buff |= ((TimeValue.year - 1980)<<25); //年
time_buff |= (TimeValue.month<<21); //月
time_buff |= (TimeValue.date<<16); //日
time_buff |= (TimeValue.hour<<11); //时
time_buff |= (TimeValue.minute<<5); //分
time_buff |= (TimeValue.second/2); //秒
return time_buff;
}
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯