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

正文內(nèi)容

基于stc89c52的可調(diào)電子鐘設(shè)計(jì)-資料下載頁

2025-11-07 19:52本頁面

【導(dǎo)讀】時(shí)間就是金錢,時(shí)間就是生命,時(shí)間就是勝利,準(zhǔn)確掌握時(shí)間并且分配時(shí)間對(duì)人們來說十分重要,時(shí)鐘是我們生活中必不可少的工具之一。設(shè)計(jì)則是利用了STC89C52單片機(jī)對(duì)DS1302時(shí)鐘芯片進(jìn)行讀寫操作,并通過時(shí)鐘數(shù)碼管來顯示時(shí)鐘信息,這樣。便構(gòu)成了一個(gè)單片機(jī)電子時(shí)鐘。品和家用電氣的各個(gè)領(lǐng)域。單片機(jī)往往是作為一個(gè)核心部件來使用的,再根據(jù)其具體硬件結(jié)構(gòu)。以及針對(duì)具體應(yīng)用對(duì)象特點(diǎn)的軟件結(jié)合,加以完善。時(shí)間對(duì)于人們來說是非常寶貴的,準(zhǔn)備掌握和分配時(shí)間對(duì)人們來說更是至關(guān)重要。廣泛,這就促使了人們不斷的設(shè)計(jì)和研發(fā)出新時(shí)鐘。時(shí)鐘電路在計(jì)算機(jī)系統(tǒng)中起著至關(guān)重要的作用,它是保證系統(tǒng)正常工作的基礎(chǔ)。部可編程定時(shí)器或者計(jì)數(shù)器來實(shí)現(xiàn);另一種是用專門的時(shí)鐘芯片來實(shí)現(xiàn)。并且有報(bào)時(shí)的功能。采用STC89C52芯片作為硬件核心。STC89C52的內(nèi)部具有8KBROM存儲(chǔ)空間,512字節(jié)數(shù)據(jù)

  

【正文】 止寫保護(hù) WriteSet1302(0x84,temp)。//向 DS1302內(nèi)寫小時(shí)寄存器 84H 寫入調(diào)整后的小時(shí)數(shù) WriteSet1302(0x8e,0x80)。//打開寫保護(hù) break。 } } } } } // void init() //定時(shí)器、計(jì)數(shù)器設(shè)置函數(shù) { TMOD=0x11。 //指定定時(shí) /計(jì)數(shù)器的工作方式為 3 TH0=0。 //定時(shí)器 T0 的高四位 =0 TL0=0。 //定時(shí)器 T0 的低四位 =0 EA=1。 //系統(tǒng)允許有開放的中斷 ET0=1。 //允許 T0 中斷 TR0=1。 //開 啟中斷,啟動(dòng)定時(shí)器 EX1=1。 EA=1。 } void display() { unsigned char ReadValue。 ReadValue = ReadSet1302(0x81)。 //從秒寄存器讀數(shù)據(jù) current_time[0]=((ReadValueamp。0x70)4)*10 + (ReadValueamp。0x0F)。//將讀出數(shù)據(jù)轉(zhuǎn)化 //顯示秒 ReadValue = ReadSet1302(0x83)。 //從 分寄存器讀 current_time[1] =((ReadValueamp。0x70)4)*10 + (ReadValueamp。0x0F)。 //將讀出數(shù)據(jù)轉(zhuǎn)化 26 //顯示分 ReadValue = ReadSet1302(0x85)。 //從分寄存器讀 current_time[2] =((ReadValueamp。0x70)4)*10 + (ReadValueamp。0x0F)。 //將讀出數(shù)據(jù)轉(zhuǎn)化 display_code[0]=duan_code[current_time[2]/10]。//小時(shí)為的十位 display_code[1]=duan_code[current_time[2]%10]。//小時(shí)位的個(gè)位 display_code[3]=duan_code[current_time[1]/10]。//分鐘位的十位 display_code[4]=duan_code[current_time[1]%10]。//分鐘為的個(gè)位 display_code[6]=duan_code[current_time[0]/10]。//秒位 的十位 display_code[7]=duan_code[current_time[0]%10]。//秒位的個(gè)位 P2=bit_code[0]。 P0=display_code[0]。 delayms(5)。 P2=bit_code[1]。 P0=display_code[1]。 delayms(5)。 P2=bit_code[2]。 P0=display_code[2]。 delayms(5)。 P2=bit_code[3]。 P0=display_code[3]。 delayms(5)。 P2=bit_code[4]。 P0=display_code[4]。 delayms(5)。 P2=bit_code[5]。 P0=display_code[2]。 delayms(5)。 P2=bit_code[6]。 P0=display_code[6]。 delayms(5)。 P2=bit_code[7]。 P0=display_code[7]。 delayms(5)。 P2=0xff。 delayms(5)。 } void read_clockS(void) { // hour1=hour。 hour = ReadSet1302(0x85)。 //讀取小時(shí)數(shù)據(jù) min = ReadSet1302(0x83)。 //讀取分鐘數(shù)據(jù) /*在本電子鐘中暫不需要讀取以下信息,暫時(shí)屏蔽 */ //sec = ReadSet1302(0x81)。 //讀取秒數(shù)據(jù) // day = DS1302_r(0x87)。 //讀取日數(shù)據(jù) //month= DS1302_r(0x89)。 //讀取月數(shù)據(jù) //week = DS1302_r(0x8b)。 //讀取星期數(shù)據(jù) //year = DS1302_r(0x8d)。 //讀取年數(shù)據(jù) } /*****讀取時(shí)間 *****/ void check_shijian(void) { read_clockS()。 //將讀出數(shù)據(jù)轉(zhuǎn)化 //hour=((houramp。0x70)4)*10 + (houramp。0x0F)。 //將讀出數(shù)據(jù)轉(zhuǎn)化 27 //顯示分 //從分寄存器讀 // min=((minamp。0x70)4)*10 + (minamp。0x0F)。 //將讀出數(shù)據(jù)轉(zhuǎn)化 //m=hour/10。 //n=hour%10。 // p=min/10。 // t=min%10。 // 顯 示 小時(shí) //顯示小時(shí) //讀取時(shí)間 m=(hour7)*8+((hour6)amp。0X01)*4+((hour5)amp。0X01)*2+((hour4)amp。0X01)。//計(jì)算得到小時(shí)十位數(shù)字 n=((hour3)amp。0x01)*8+((hour2)amp。0X01)*4+((hour1)amp。0X01)*2+(houramp。0X01)。//計(jì)算得到小時(shí)個(gè)位數(shù)字 p=(min7)*8+((min6)amp。0X01)*4+((min5)amp。0X01)*2+((min4)amp。0X01)。 //計(jì)算得到分鐘十位數(shù)字 t=((min3)amp。0x01)*8+((min2)amp。0X01)*4+((min1)amp。0X01)*2+(minamp。0X01)。// 算 得到分鐘個(gè) 位數(shù)字 } void main(void) { init()。 while(1) { /*if(adjust_flag==0) { //掃描按鍵,當(dāng)按鍵沒有被按下時(shí),單片機(jī)從 ds1302 讀取時(shí)間數(shù)據(jù) ReadValue = ReadSet1302(0x81)。 //從秒寄存器讀數(shù)據(jù) current_time[0]=((ReadValueamp。0x70)4)*10 + (ReadValueamp。0x0F)。//將讀出數(shù)據(jù)轉(zhuǎn)化 //顯示秒 ReadValue = ReadSet1302(0x83)。 //從分寄存器讀 current_time[1] =((ReadValueamp。0x70)4)*10 + (ReadValueamp。0x0F)。 //將讀出數(shù)據(jù)轉(zhuǎn)化 //顯示分 ReadValue = ReadSet1302(0x85)。 //從分寄存器讀 current_time[2] =((ReadValueamp。0x70)4)*10 + (ReadValueamp。0x0F)。 //將讀出數(shù)據(jù)轉(zhuǎn)化 //顯示小時(shí) } */ keyscan()。 display()。 if(key4==0) {delayms(10)。 if(key4==0) { check_shijian()。 yuyin()。 delayms(20)。 } } while(!key4)。 } } void timer0() interrupt 1 //取得并顯示日歷和時(shí)間 { unsigned char ReadValue。 ReadValue = ReadSet1302(0x81)。 //從秒寄存器讀數(shù)據(jù) current_time[0]=((ReadValueamp。0x70)4)*10 + (ReadValueamp。0x0F)。//將讀出數(shù)據(jù)轉(zhuǎn)化 miao = current_time[0]。 //顯示秒 ReadValue = ReadSet1302(0x83)。 //從分寄存器 讀 current_time[1] 28 =((ReadValueamp。0x70)4)*10 + (ReadValueamp。0x0F)。 //將讀出數(shù)據(jù)轉(zhuǎn)化 fen = current_time[1]。 //顯示分 ReadValue = ReadSet1302(0x85)。 //從分寄存器讀 current_time[2] =((ReadValueamp。0x70)4)*10 + (ReadValueamp。0x0F)。 //將讀出數(shù)據(jù)轉(zhuǎn)化 shi =current_time[2] 。 //顯示溫度、秒、時(shí)、分?jǐn)?shù)據(jù): } void baoshi(unsigned char z) { //每讀取一個(gè)地址的內(nèi)容,先發(fā)送一個(gè)觸發(fā)信號(hào) RST2=1。 delayms(12)。 RST2=0。 delayms(12)。 while(z0) { SDA=1。 delayms(12)。 SDA=0。 delayms(12)。 z。 } while(!busy)。 delayms(12)。 } void yuyin() { busy=1。//初始化,判忙端置 1,表示不忙 SDA=0。//初始化,信號(hào)端置 0,表示無信號(hào) RST2=0。//初始化,觸發(fā)端置 0,表示無觸發(fā) baoshi(22)。 if(m==0amp。amp。n==0) { baoshi(1)。 } else if(m==0amp。amp。n!=0) { baoshi(n+1)。 } else if(m==1amp。amp。n==0) { baoshi(11)。 } else if(m==1amp。amp。n!=0) { baoshi(11)。 baoshi(n+1)。 } else if(n!=0) { baoshi(m+1)。 baoshi(11)。 baoshi(n+1)。 } else if(n==0) { baoshi(m+1)。 baoshi(11)。 } baoshi(13)。 if(p==0amp。amp。t==0) { } else if(p==0amp。amp。t!=0) 29 { baoshi(p+1)。 baoshi(t+1)。 } else if(p==1amp。amp。t==0) { baoshi(11)。 } else if(p==1amp。amp。t!=0) { baoshi(11)。 baoshi(t+1)。 } else if(t==0) { baoshi(p+1)。 baoshi(11)。 } else if(t!=0) { baoshi(p+1)。 baoshi(11)。 baoshi(t+1)。
點(diǎn)擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計(jì)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1