基于單片機(jī)的實(shí)時(shí)日歷時(shí)鐘顯示系統(tǒng)_第1頁(yè)
基于單片機(jī)的實(shí)時(shí)日歷時(shí)鐘顯示系統(tǒng)_第2頁(yè)
基于單片機(jī)的實(shí)時(shí)日歷時(shí)鐘顯示系統(tǒng)_第3頁(yè)
基于單片機(jī)的實(shí)時(shí)日歷時(shí)鐘顯示系統(tǒng)_第4頁(yè)
基于單片機(jī)的實(shí)時(shí)日歷時(shí)鐘顯示系統(tǒng)_第5頁(yè)
已閱讀5頁(yè),還剩3頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、xxxxxxx學(xué) 院 本 科 畢 業(yè) 設(shè) 計(jì)(論文)基于單片機(jī)的實(shí)時(shí)時(shí)鐘顯示系統(tǒng)設(shè)計(jì)學(xué) 院(系): 計(jì)算機(jī)科學(xué)與技術(shù)系 專(zhuān) 業(yè): 通信工程 學(xué) 生 姓 名: 學(xué) 號(hào): 指 導(dǎo) 教 師: 完 成 日 期: 摘 要20世紀(jì)末,電子技術(shù)獲得了飛速的發(fā)展,在其推動(dòng)下,現(xiàn)代電子產(chǎn)品幾乎滲透了社會(huì)的各個(gè)領(lǐng)域,有力地推動(dòng)了社會(huì)生產(chǎn)力的發(fā)展和社會(huì)信息化程度的提高,同時(shí)也使現(xiàn)代電子產(chǎn)品性能進(jìn)一步提高,產(chǎn)品更新?lián)Q代的節(jié)奏也越來(lái)越快。現(xiàn)代生活的人們?cè)絹?lái)越重視起了時(shí)間觀念,可以說(shuō)是時(shí)間和金錢(qián)劃上了等號(hào)。對(duì)于那些對(duì)時(shí)間把握非常嚴(yán)格和準(zhǔn)確的人或事來(lái)說(shuō),時(shí)間的不準(zhǔn)確會(huì)帶來(lái)非常大的麻煩,所以以數(shù)碼管為顯示器的時(shí)鐘比指針式的時(shí)

2、鐘表現(xiàn)出了很大的優(yōu)勢(shì)。數(shù)碼管顯示的時(shí)間簡(jiǎn)單明了而且讀數(shù)快、時(shí)間準(zhǔn)確顯示到秒。而機(jī)械式的依賴(lài)于晶體震蕩器,可能會(huì)導(dǎo)致誤差。數(shù)字鐘是采用數(shù)字電路實(shí)現(xiàn)對(duì)“時(shí)”、“分”、“秒”數(shù)字顯示的計(jì)時(shí)裝置。數(shù)字鐘的精度、穩(wěn)定度遠(yuǎn)遠(yuǎn)超過(guò)老式機(jī)械鐘。在這次設(shè)計(jì)中,我們采用led數(shù)碼管顯示時(shí)、分、秒,以24小時(shí)計(jì)時(shí)方式,根據(jù)數(shù)碼管動(dòng)態(tài)顯示原理來(lái)進(jìn)行顯示,用12mhz的晶振產(chǎn)生振蕩脈沖,定時(shí)器計(jì)數(shù)。在此次設(shè)計(jì)中,電路具有顯示時(shí)間的其本功能,還可以實(shí)現(xiàn)對(duì)時(shí)間的調(diào)整。數(shù)字鐘是其小巧,價(jià)格低廉,走時(shí)精度高,使用方便,功能多,便于集成化而受廣大消費(fèi)的喜愛(ài),因此得到了廣泛的使用。關(guān)鍵字:數(shù)字電子鐘 單片機(jī)abstractthe

3、late 20th century, electronic technology has been rapid development in its promotion,penetration of modern electronic products will almost fields, a strong impetus to the development of social productive forces and social improvement in the level of information, while also further improve the perfor

4、mance of modern electronic products, replacement products have become increasingly fast pace. growing emphasis on modern life from the time the concept of time and money can be said to draw the equal sign. for those who are very strict and accurate grasp of time and things, time will not exactly bri

5、ng a very big trouble, so as to control the display of digital clock than the clock pointer showed a big advantage. digital display of time reading simple and fast, accurate display of time to seconds. the mechanical oscillator depends on the crystal may lead to errors. digital clock is a digital ci

6、rcuit implementation of the when, sub, seconds the figures show the timing device. digital clock precision, stability, far more than the old mechanical clock. in this design, we use led digital display hours, minutes, seconds, to 24-hour time mode, according to digital control theory to dynamic disp

7、lay to display, use the 12mhz crystal oscillation pulse, the timer count. in this design, the circuit has a display time of the this function, you can also realize the time adjustment. digital clock is its compact, low cost, travel time and high precision, easy to use, features and more, easy integr

8、ation and loved by the general consumer, so widely used. keywords: digital electronic clock scm前 言本例的功能是在51單片機(jī)系統(tǒng)中設(shè)置,獲取,記錄實(shí)時(shí)的日歷時(shí)鐘信息并通過(guò)數(shù)碼管顯示,要求能夠進(jìn)行長(zhǎng)時(shí)間的記錄,并且存儲(chǔ)的時(shí)間信息在掉電情況下至少保存10年以上。該系統(tǒng)包含5個(gè)模塊:51單片機(jī)模塊,日歷時(shí)鐘模塊,數(shù)碼管顯示模塊,串行通信模塊,c51程序。本系統(tǒng)用到的電路及程序如下: 程序代碼如下:#define_calendarclk_h / 防止calendarclk.h被重復(fù)引用#define_cal

9、endarclk_h#include #include #define uchar unsigned char#define unint unsigned int/* ds12c887 內(nèi)部專(zhuān)用寄存器宏定義 */#define min xbyte0x0102#define hour xbyte0x0104#define dayofweek xbyte0x0106#define dayofmonth xbyte0x0107#define month xbyte0x0108#define year xbyte0x0109#define reg_a xbyte0x010a#define reg_b

10、xbyte0x010b/* 由串口獲得的日歷時(shí)鐘信息變量,用于對(duì)芯片時(shí)間的設(shè)置 */uchar year1,month1,dayofweek1,dayofmonth1,hour1,min1;/* 芯片ds12c887提供的日歷時(shí)鐘信息變量 */uchar year2,month2,dayofweek2,dayofmonth2,hour2,min2;/* 從串行口獲取數(shù)據(jù)函數(shù),數(shù)據(jù)包括:year1,month1,dayofweek1,dayofmonth1,hour1,min1。如果獲取到正確數(shù)據(jù)則返回1,否則返回0 */uchar getdata()/ 略去/* 設(shè)置日歷和時(shí)鐘函數(shù) */voi

11、d settime()reg_b = reg_b|0x80;/ set=1,芯片ds12c887處于設(shè)置狀態(tài)min = min1;hour = hour1;dayofweek = dayofweek1;dayofmonth = dayofmonth1;month = month1;year = year1;reg_b = reg_b&0x7f; / set=0,芯片ds12c887恢復(fù)正常數(shù)據(jù)更新?tīng)顟B(tài)/* 獲取日歷時(shí)鐘信息函數(shù) */void gettime()while (reg_a&0x80=0x00)/ 直到uip=0時(shí),才能讀取日歷時(shí)鐘信息min2 = min ;hour2 = hour

12、;dayofweek2 = dayofweek;dayofmonth2 = dayofmonth; month2 = month;year2 = year;/* 13位數(shù)碼管顯示年、月、日、星期、時(shí)、分 */void display()/ 略去/* 串口初始化函數(shù) */void init_serial()tmod = 0x20;/ 定時(shí)器t1使用工作方式2th1 = 250;tl1 = 250;tr1 = 1;/ 開(kāi)始計(jì)時(shí)pcon = 0x80;/ smod = 1scon = 0x50;/ 工作方式1,波特率9600kbit/s,允許接收 void main(void)uchar setflag;init_serial();/* 設(shè)置dv2、dv1、dv0為010,打開(kāi)芯片ds12c877內(nèi)部晶振 */reg_a = reg_a&0xaf;/ dv2=dv0=0reg_a = reg_a|0x20;/ dv1=0reg_b = reg_b&0x7b;/ set=0,時(shí)間數(shù)據(jù)正常更新;dm=0,二進(jìn)制數(shù)

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論