freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

本科畢業(yè)論文-基于51單片機的智能電子時鐘設(shè)計【完-文庫吧

2025-05-14 08:22 本頁面


【正文】 第三章 電子時鐘的軟件設(shè)計 倒計時版本 /******************************************************************************* 項目編號: CLK01 名稱:多功能時鐘 39。tonkeys amp。 輕風(fēng)工作室提供 39。專業(yè) VB 編程,畢業(yè)設(shè)計 VB 代編程 ,單片機程序設(shè)計。 39。:58507961 (技術(shù)支持) 10+年編程經(jīng)驗 39。拍拍: 39。淘寶: 日期: 2021825 *******************************************************************************/ include // //縮寫宏定義 // define uchar unsigned char define uint unsigned int //數(shù)碼管位置宏 define DEG1 4 define DEG2 5 define DEG3 2 define DEG4 3 define DEG5 0 define DEG6 1 // //函數(shù)聲明 // uchar GetMDays(uchar cyear, uchar cmonth)。 //返回當(dāng)前日期的月份天數(shù) void T0_init()。 void LedSet(uchar pos, uchar num)。 uchar GetKey(void)。 //讀取按鍵 void TaskSecond()。 //秒表模式 void TaskSetTime()。 //時間設(shè)置模式 void TaskStopWatch()。//倒計時 void TaskDate()。 //日期 uchar InKey()。 //等待一個按鍵 void Beep()。 //200ms 按鍵音 // //全局變量 // uchar tm_year=13,tm_month=8,tm_day=1。 //年月日 uchar tm_hour=10,tm_minute=15,tm_second=0。 //時分秒 uchar tm_x10ms=0。 //x10mS uint gms。 uchar mode=0。 uchar beep_delay=0。 uchar Light_Set=7。 //7最亮 20暗 uchar Light_Delay=60。 //延時變暗 // //主函數(shù) // void main() { T0_init()。 while (1) { //顯示時間 LedSet(DEG1,tm_hour / 10)。 LedSet(DEG2,tm_hour % 10)。 LedSet(DEG3,tm_minute / 10)。 LedSet(DEG4,tm_minute % 10)。 LedSet(DEG5,tm_second / 10)。 LedSet(DEG6,tm_second % 10)。 LedSet(6,0xE0)。 switch (GetKey()) { case 0x01: //mode Beep()。 TaskSecond()。 //秒表模式 TaskStopWatch()。 //倒計時模式 TaskDate()。 //日期模式 break。 case 0x02: //Set Beep()。 TaskSetTime()。 //進入時間設(shè)置模式 break。 case 0x04: //up break。 case 0x08: //down break。 default: 。 } } } // //LED 動態(tài)掃描 // uchar code led_code[]={3,207,42,74,198,82,18,203,2,66, 0,0,0,0,0,0,0,0,0,0,255}。 uchar led_buf[8]。 uchar led_scan_step=0。 void LedScan() { P1=0。 //off if (led_scan_step7) { P0=led_buf[led_scan_step]。 P1=1led_scan_step。 } led_scan_step++。 if (led_scan_stepLight_Set ) led_scan_step=0。 } // //定時器初始化 125uS for 12Mhz Osc // void T0_init() { TMOD=0X02。 TH0=(256125)。 TL0=(256125)。 EA=1。 ET0=1。 TR0=1。 } // //定時中斷 // uchar xcou=0。 uchar ms=0。 bit bz_flag。 bit beep_en=0。 void time0 (void) interrupt 1 { if (beep_en) { bz_flag=!bz_flag。 P2_7=bz_flag。 } xcou++。 if (xcou==2) { LedScan()。 //LED 掃描 }else if (xcou==8 ) { xcou=0。 ms++。 gms++。 //臨時計數(shù)用的 if (ms==10) { tm_x10ms++。 ms=0。 if (beep_delay!=0) { beep_delay。 if (beep_delay !=0) beep_en=1。 else beep_en=0。 } if (tm_x10ms==100) //秒 { tm_second++。 if (Light_Delay !=0) { Light_Delay。 if (Light_Delay ==0) Light_Set=20。 //變暗 else Light_Set=7。 //亮度高 } tm_x10ms=0。 if (tm_second==60) //分 { tm_minute++。 tm_second=0。 if (tm_minute==60) //時 { tm_hour++。 tm_minute=0。 if (tm_hour==24) //日 { tm_day++。 tm_hour=0。 if (tm_dayGetMDays(tm_year,tm_month)) //月 { tm_month++。 tm_day=1。 if (tm_month12) //年 { tm_year++。 tm_month=1。 } } } } } } } } } // //返回當(dāng)前日期的月份天數(shù) // uchar code daylist[]={31,28,31,30,31,30,31,31,30,31,30,32}。 //平年各月天數(shù) uchar GetMDays(uchar cyear, uchar cmonth) { uchar rtn。 rtn=daylist[cmonth1]。 if (cyear % 4==0 amp。amp。 cmonth==2) //閏年 2 月 rtn=29。 return (rtn)。 } // //設(shè)置指定位置數(shù)碼管的字符 // void LedSet(uchar pos, uchar num) { if (pos=6) led_buf[pos]=num。 else { led_buf[pos]=led_code[num]。 } } // //GetKey 讀取按鍵 // uchar GetKey(void) { uchar rtn=0。 bit flag。 flag=1。 if (P3_4==0) rtn =0x01。//mode else if (P3_5==0) rtn|=0x02。 //set else if (P3_6==0) rtn|=0x04。 //up else if (P3_7==0) rtn|=0x08。 //down else flag=0。 //pressed if (flag) { gms=0。 while (P3_4==0 || P3_5==0 ||P3_6==0 || P3_7==0) { if (gms1000) gms=1000。 } if (gms10) rtn=0。 //抗抖過濾小于 10ms 的信號 else { Beep()。 Light_Delay=60。 } }else rtn=0。 return (rtn)。 } // //秒表模式 // void TaskSecond() { uchar hh=0,mm=0,ss=0,x10ms=0,ccms。 uchar tmp。 while (1) { LedSet(DEG1,0)。 LedSet(DEG2,0)。 LedSet(DEG3,0)。 LedSet(DEG4,0)。 LedSet(DEG5,0)。 LedSet(DEG6,0)。 LedSet(6,0xD4 )。 tmp=InKey()。 //等待啟動鍵 if (tmp==0x01) //mode key exit { return。 } else if (tmp==0x04 || tmp==0x08) //set key start { //運行中 gms=0。 while (1) { if (gms!=0) { ccms++。 gms。 if (ccms==10) { x10ms++。 ccms=0。 if (x10ms==100) { ss++。 x10ms=0。 if (ss==60) { ss=0。 mm++。 if (mm==60) { hh++。 if (hh==100) hh=0。 } } } }else if (ccms==9) //刷新顯示 { if (hh==0) { LedSet(DEG1,mm / 10)。 LedSet(DEG2,mm % 10)。 LedSet(DEG3,ss / 10)。 LedSet(DEG4,ss % 10)。 LedSet(DEG5,x10ms / 10)。 LedSet(DEG6,x10ms % 10)。 LedSet(6,0xD4 )。 }else { LedSet(DEG1,hh / 10)。 LedSet(DEG2,hh % 10)。 LedSet(DEG3,mm / 10)。 LedSet(DEG4,mm % 10)。 LedSet(DEG5,ss / 10)。 LedSet(DEG6,ss % 10)。 LedSet(6,0xD0 )。 } }else { switch (GetKey()) { case 0x01: //mode 退出 return 。 break。 case 0x02: //set 暫停 while (1) { tmp=GetKey()。 if (tmp== 0x01) //mode exit return。 else if(tmp==0x04 || tmp==0x08) //繼續(xù) break。 else if (tmp== 0x02)//重置 { LedSet(DEG1,0)。 LedSet(DEG2,0)。 LedSet(DEG3,0)。 LedSet(DEG4,0)。 LedSet(DEG5,0)。 LedSet(DEG6,0)。 LedSet(6,0xD4 )。 hh=0。mm=0。ss=0。x10ms=0。ccms =0。 } } break。 } } } } } } } /
點擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1