91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡(jiǎn)介

STC15 萬(wàn)年歷程序,STC15 萬(wàn)年歷程序,STC15 萬(wàn)年歷程序 詳情看博客文章

資源截圖

代碼片段和文件信息

#include?“Clock.h“





void?Init_Clock()
{
????memset(&stClock?0?sizeof(struct?_stClock));
????
????stClock.tYer?=?17;
????stClock.tMon?=?4;
????stClock.tDay?=?24;
????stClock.tHor?=?18;
????stClock.tMin?=?19;
????stClock.tSec?=?0;
????
????stClock.tWek?=?ReturnWeekDay(2000?+?stClock.tYer?stClock.tMon?stClock.tDay);
}

//?輸入?年
//?返回?1:閏年/?0:平年
unsigned?char?IsLeapYear(unsigned?char?y)
{
????unsigned?int?year;
????year?=?2000?+?y;
????
????if((year%4==0?&&?year%100!=0)?||?year%400==0)
????????return?true;
????else
????????return?false;
}


//?輸入?年/月
//?返回?當(dāng)月天數(shù)
unsigned?char?GetMaxDay(unsigned?char?y?unsigned?char?m)
{
????if(m?==?2)
????{
????????if(IsLeapYear(y))
????????????return?29;
????????else
????????????return?28;
????}
????else?if((m?==?4)||(m?==?6)||(m?==?9)||(m?==?11))
????????return?30;
????else
????????return?31;
}


//?輸入?年/月/日
//?返回?星期幾
unsigned?char?ReturnWeekDay(?unsigned?int?iYear?unsigned?char?iMonth?unsigned?char?iDay?)??
{??
????int?iWeek?=?0;??
????unsigned?int?y?=?0?c?=?0?m?=?0?d?=?0;??
??
????if?(?iMonth?==?1?||?iMonth?==?2?)??
????{??
????????c?=?(?iYear?-?1?)?/?100;??
????????y?=?(?iYear?-?1?)?%?100;??
????????m?=?iMonth?+?12;??
????????d?=?iDay;??
????}??
????else??
????{??
????????c?=?iYear?/?100;??
????????y?=?iYear?%?100;??
????????m?=?iMonth;??
????????d?=?iDay;??
????}??
??????
????iWeek?=?y?+?y?/?4?+?c?/?4?-?2?*?c?+?26?*?(?m?+?1?)?/?10?+?d?-?1;????//?蔡勒公式??
????iWeek?=?iWeek?>=?0???(?iWeek?%?7?)?:?(?iWeek?%?7?+?7?);?????????????//?iWeek為負(fù)時(shí)取模??
????if?(?iWeek?==?0?)???????????????????????????????????????????????????//?星期日不作為一周的第一天??
????{??
????????iWeek?=?7;??
????}??
??
????return?iWeek;??
}?

void?TimerToStr()
{
????str[0]?=?‘2‘;
????str[1]?=?‘0‘;
????str[2]?=?(stClock.tYer?/?10)?+?48;
????str[3]?=?(stClock.tYer?%?10)?+?48;
????str[4]?=?‘-‘;
????str[5]?=?(stClock.tMon?/?10)?+?48;
????str[6]?=?(stClock.tMon?%?10)?+?48;
????str[7]?=?‘-‘;
????str[8]?=?(stClock.tDay?/?10)?+?48;
????str[9]?=?(stClock.tDay?%?10)?+?48;
????str[10]?=?‘?‘;
????str[11]?=?(stClock.tHor?/?10)?+?48;
????str[12]?=?(stClock.tHor?%?10)?+?48;
????str[13]?=?‘:‘;
????str[14]?=?(stClock.tMin?/?10)?+?48;
????str[15]?=?(stClock.tMin?%?10)?+?48;
????str[16]?=?‘:‘;
????str[17]?=?(stClock.tSec?/?10)?+?48;
????str[18]?=?(stClock.tSec?%?10)?+?48;
????str[19]?=?‘?‘;
????str[20]?=?stClock.tWek?+?48;
????str[21]?=?‘\n‘;
????str[22]?=?0;
}


void?UpdateClock()
{
????//?100?ms
????if(stClock.Flag.t100msFlag)
????{
????????stClock.Flag.t100msFlag?=?false;
????????stClock.t1ms?=?0;
????????stClock.t100ms++;
????????if(stClock.t100ms?>=?5)
????????????stClock.Flag.t500msFlag?=?true;
????????
????????//?串口接收超時(shí)計(jì)數(shù)
????????if(Sys_Bit_A.Uart_Received_Flag)
????????{
????????????RxTimeoutCount++;
????????????if(RxTimeoutCount?>?2)
????????????{
????????????????RxTimeoutCount?=?0;
????????????????Sys_Bit_A.Uart_Received_Flag?=?false

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????5464??2018-08-25?12:28??Clock.c
?????文件?????????360??2018-08-25?11:18??Clock.h
?????文件?????????160??2018-03-21?10:58??Clock.plg
?????文件????????6684??2018-04-18?16:56??Clock.uvopt
?????文件???????14710??2018-04-18?16:56??Clock.uvproj
?????文件??????????23??2017-04-18?18:05??Constant.c
?????文件????????1733??2018-08-25?11:52??Constant.h
?????文件????????1594??2018-08-25?12:04??main.c
?????文件????????6376??2013-06-24?10:27??STARTUP.A51
?????文件????????1987??2018-08-25?12:04??sys.c
?????文件?????????384??2018-08-25?11:28??sys.h
?????文件?????????316??2018-08-25?11:52??Variable.c

評(píng)論

共有 條評(píng)論

相關(guān)資源