畢業(yè)設(shè)計-基于AT89C51單片機的秒表設(shè)計.doc

上傳人:good****022 文檔編號:116452227 上傳時間:2022-07-05 格式:DOC 頁數(shù):18 大?。?87.52KB
收藏 版權(quán)申訴 舉報 下載
畢業(yè)設(shè)計-基于AT89C51單片機的秒表設(shè)計.doc_第1頁
第1頁 / 共18頁
畢業(yè)設(shè)計-基于AT89C51單片機的秒表設(shè)計.doc_第2頁
第2頁 / 共18頁
畢業(yè)設(shè)計-基于AT89C51單片機的秒表設(shè)計.doc_第3頁
第3頁 / 共18頁

下載文檔到電腦,查找使用更方便

20 積分

下載資源

還剩頁未讀,繼續(xù)閱讀

資源描述:

《畢業(yè)設(shè)計-基于AT89C51單片機的秒表設(shè)計.doc》由會員分享,可在線閱讀,更多相關(guān)《畢業(yè)設(shè)計-基于AT89C51單片機的秒表設(shè)計.doc(18頁珍藏版)》請在裝配圖網(wǎng)上搜索。

1、目 錄一、設(shè)計的內(nèi)容、要求及目的1二、系統(tǒng)總體方案選擇與說明1三、系統(tǒng)方框圖與工作原理2四、各部分方案選定、功能及計算24.1 按鍵部分24.2 顯示部分3五、器件說明4六、調(diào)試說明、使用說明4心得體會5參考文獻5附錄6附錄A 系統(tǒng)原理圖6附錄B 程序清單7一、 設(shè)計的內(nèi)容、要求及目的設(shè)計內(nèi)容我設(shè)計的是以51單片機為核心的秒表,顯示“00.00”,第1次按下1按鈕后就開始計時;第2次按1按鈕后,計時停止;然后按2按鈕可以記錄;最后按3按鈕,計時歸零。通過液晶顯示器顯示秒十位、個位、小數(shù)點后一位和兩位,最小單位為0.01秒,在設(shè)計過程中用一個存儲單元作為秒計數(shù)單元,當一秒鐘到來時,就讓秒計數(shù)單元

2、加1,當秒計數(shù)達到59.59時,就自動返回到00.00,重新開始秒計數(shù)。設(shè)計要求1. 設(shè)計方案要合理、正確;2. 系統(tǒng)硬件設(shè)計;3. 完成必要元器件選擇;4. 系統(tǒng)軟件設(shè)計及調(diào)試;5. 寫出設(shè)計報告。設(shè)計目的本次設(shè)計的是秒表,為了更好的完成課程設(shè)計,采用的是硬件定時,即用單片機內(nèi)部的定時器T0。先將時鐘初始化,賦入初值50ms定時,循環(huán)20次來進行1秒定時。采用的是AT89C51單片機,有按鍵部分和顯示部分。二、 系統(tǒng)總體方案選擇與說明此次課程設(shè)計題目是秒表,由于此次課程設(shè)計要求是秒表,則在定時時要求比較精確,所以采用硬件的定時器定時時比較準確的;由于秒表的定時程序是很小的,在利用軟件定時占用

3、的CPU并不是很多,不能顯現(xiàn)出來,但真正大程序時會很占用資源的,所以在用定時中斷過程中是非常節(jié)省資源的由課程設(shè)計的要求和任務(wù),我采用的C語言編程,設(shè)計秒表要求一秒定時,采用了定時器,即用單片機內(nèi)部的定時器T0。先將時鐘初始化,賦入初值50ms定時,循環(huán)20次來進行1秒定時。然后由定義的變量second來進行加一運算,然后將其值通過P2口在數(shù)碼管上進行顯示。其中數(shù)碼管的顯示時,我在程序中首先定義了一個關(guān)于數(shù)碼管顯示的字形碼定義,以便在顯示時調(diào)用即可。本次采用的是AT89C51單片機:AT89C51是一種帶4K字節(jié)FLASH存儲器(FPEROMFlash Programmable and Eras

4、able Read Only Memory)的低電壓、高性能CMOS 8位微處理器,俗稱單片機。AT89C2051是一種帶2K字節(jié)閃存可編程可擦除只讀存儲器的單片機。單片機的可擦除只讀存儲器可以反復擦除1000次。該器件采用ATMEL高密度非易失存儲器制造技術(shù)制造,與工業(yè)標準的MCS-51指令集和輸出管腳相兼容。由于將多功能8位CPU和閃爍存儲器組合在單個芯片中,ATMEL的AT89C51是一種高效微控制器,AT89C2051是它的一種精簡版本。AT89C單片機為很多嵌入式控制系統(tǒng)提供了一種靈活性高且價廉的方案。引腳排列如圖所示主要特性:與MCS-51 兼容 4K字節(jié)可編程FLASH存儲器 壽

5、命:1000寫/擦循環(huán) 數(shù)據(jù)保留時間:10年 全靜態(tài)工作:0Hz-24MHz 三級程序存儲器鎖定 1288位內(nèi)部RAM 32可編程I/O線 兩個16位定時器/計數(shù)器 5個中斷源 可編程串行通道 低功耗的閑置和掉電模式片內(nèi)振蕩器和時鐘電路三、 系統(tǒng)方框圖與工作原理秒表采用的是AT89C51單片機,單片機的P1口連接著按鍵,實現(xiàn)按鍵功能;P0、P2、P3口連接著顯示器,實現(xiàn)顯示功能。如圖3.1所示:按鍵顯示器AT89C51 P0P1 P2 P3 圖3.1秒表總體系統(tǒng)方框圖四、 各部分方案選定、功能及計算4.1 按鍵部分K1和單片機的P1.0口相連,實現(xiàn)啟動/停止功能,按下K1鍵,開啟計時功能,再按

6、一下,即停止計時;K2和單片機的P1.1相連,實現(xiàn)記錄功能,按下K2鍵,開啟記錄功能,共有3個可以記錄;K3和單片機的P1.2相連,實現(xiàn)重置功能按下K3,即清零重置。如圖4.1所示:圖4.1按鍵部分4.2 顯示部分單片機的P2.0到P2,7分別和顯示器的D0到D7相對應連接;單片機的P0.0到P0.3分別和顯示器的CS1、CS2、RW和RS相對應連接;單片機的P3.4和顯示器的E相對應連接。以上是實現(xiàn)顯示功能,如圖4.2所示:圖4.2顯示部分五、 器件說明(1) MCS-51單片機實驗操作臺1臺;(2) PC機及單片機調(diào)試軟件;(3) 單片機應用系統(tǒng)板1套;(4) 制作工具1套;(5) 系統(tǒng)設(shè)

7、計所需的元器件。六、調(diào)試說明、使用說明編好的程序在Keil中有許多錯誤,這些錯誤在平時的實驗中也碰到過很多。例如,字母開頭忘了加0,零和字母搞錯了,有些標號用了幾次,CJNE寫成了CJNZ等等,幸好這些錯誤在平時實驗中遇到很多次了,所以改正很快的。除了常見錯誤,還有些錯誤在平時沒遇到過的。如:AJMP指令跳轉(zhuǎn)不回指定的地位,是由于跳轉(zhuǎn)的長度大于AJMP跳轉(zhuǎn)的長度,最后只有用LJMP跳轉(zhuǎn)后跳到指定的位置。在幾天的調(diào)試和修改程序中,我的知識也得到了鞏固,使我對單片機的知識更加的渴望。在Proteus編輯窗口中單擊開始仿真按鈕,開始仿真,按啟動按鈕,開始讀秒,按記錄按鈕記錄數(shù)據(jù),可以記錄3個數(shù)據(jù),最

8、后按重置按鈕,重置數(shù)據(jù)。如圖6.1所示:圖6.1心得體會通過這次課程設(shè)計秒表計時器,使我又重新開始學習C語言,因為C語言是大一學的,至從學完就再也沒用過,所以開始很陌生,我又找了有關(guān)資料來了解,才有了一點眉目。剛開始以為可以用匯編很容易就寫出來,以為學的很明白了,但是用匯編時才發(fā)現(xiàn)原來都不怎么熟練,編了一會程序發(fā)現(xiàn)只有一種感覺舉步維艱??!還是放棄匯編選擇C語言吧!對于單片機,我們課本學習的是80C51,但是這次做課程設(shè)計用的是89C51,這樣不僅使我們掌握了80C51,而且對89C51也有了一定的了解了,在課堂上學習的都理論的,跟實際永遠有一定的差距,不實踐就不會發(fā)現(xiàn)問題。而且我還更加熟練的應

9、用了proteus和keil兩個軟件。通過這次課程設(shè)計使我把課堂上學習的東西都用到了實踐中,例如:定時/計數(shù)器的應用與中斷。學習的時候不怎么理解,但是在實踐中應用了以后就自然了解了。這次課程設(shè)計使我受益匪淺,而且都是實際的東西。最后,還要感謝本次課程設(shè)計的老師,也是我們單片機的老師,感謝在老師悉心的指導下,完成了本次課程設(shè)計。參考文獻1、 單片機原理與應用 王迎旭等編 機械工業(yè)出版社2、 51系列單片機設(shè)計實例 樓然苗等編 北京航空航天大學出版社3、 計算機硬件技術(shù)基礎(chǔ)實驗教程 黃勤等編 重慶大學出版社4、微型計算機接口技術(shù)及應用 劉樂善主編 華中科技大學出版社5、單片微型計算機原理及接口技術(shù)

10、陳光東等 華中科技大學出版社附錄附錄A 系統(tǒng)原理圖附錄B 程序清單#include#includechar status=0,c=0,c_r=1;char save1_m,save1_s,save2_m,save2_s,save3_m,save3_s,save4_m,save4_s;sbit led1=P34;sbit led2=P35;sbit led3=P36;sbit led=P30;bit flag=0;bit reset=0;ui dj,zj,lc;uc m=0,s=0;extern scan_key1();extern scan_key2();extern scan_key3();

11、extern scan_key4();extern scan_key5();void delay(uc a)uc i;while(a-)for(i=100;i0;i-);void initshow() /0 xb80 xbf表示第07頁(64行); 0 x01_表示行(0 x400 x3f) display_HZ(0 xb8,0 x40,HZ0); /單 display_HZ(0 xb8,0 x50,HZ1); /價 display_FH(0 xb8,0 x60,FH0); /:/* display_HZ(0 xb8,0 xB0,HZ8); /元 */ display_HZ(0 xba,0 x

12、40,HZ2); /里:一個漢字占2行 行+2 display_HZ(0 xba,0 x50,HZ3); /程 display_FH(0 xba,0 x60,FH0); /:/* / Display_FiveNum(0 xba,0 xA8,lc); /display_FH(0 xba,0 xB0,FH2); /k display_FH(0 xba,0 xB4,FH3); /m display_HZ(0 xbc,0 x40,HZ4); /總 display_HZ(0 xbc,0 x50,HZ1); /價 display_FH(0 xbc,0 x60,FH0); /: / Display_Five

13、Num(0 xbc,0 xA8,zj); display_HZ(0 xbc,0 xB0,HZ8); /元 void ad_time(void) s+; if(s=60)s=0; m+; if(m=60)m=0;void save_second(char i)if(i=1) save1_m=m;save1_s=s; else if(i=2) save2_m=m;save2_s=s; else if(i=3) save3_m=m;save3_s=s; void recover_second(char i) if(i=1) m=save1_m;s=save1_s; else if(i=2) m=sa

14、ve2_m;s=save2_s; else if(i=3) m=save3_m;s=save3_s; else if(i=4) m=save4_m;s=save4_s; void init(void) TMOD=0 x01; TH0=(65536-16600)/256; TL0=(65536-16600)%256; EA=1; ET0=1; TR0=0; void main(void) ui t=1000; init(); iniLCD(); ClearScreen(2); initshow(); Display_FiveNum(0 xb8,0 x80,m,s); while(1) /鍵盤掃描

15、程序 led=led; if(scan_key1()=1) TR0=TR0; else if(scan_key2()=1&TR0=1) led1=led1; flag=1; c+; save_second(c); if(c=4)c=50; else if(scan_key3()=1) TR0=0; ClearScreen(2); initshow(); Display_FiveNum(0 xb8,0 x80,0,0); m=0;s=0;c=0; void timer0(void) interrupt 1 TH0=(65536-16600)/256; TL0=(65536-16600)%256;

16、 ad_time(); if(flag=1) flag=0; TR0=0; if(c=1)Display_FiveNum(0 xba,0 x80,save1_m,save1_s); else if(c=2)Display_FiveNum(0 xbc,0 x80,save2_m,save2_s); else if(c=3)Display_FiveNum(0 xbe,0 x80,save3_m,save3_s); TR0=1; Display_FiveNum(0 xb8,0 x80,m,s);按鍵#include#define uchar unsigned charsbit key1=P10;bi

17、t f_k1=1;sbit key2=P11;bit f_k2=1;sbit key3=P12;bit f_k3=1;sbit key4=P13;bit f_k4=1;sbit key5=P14;bit f_k5=1;void delay(char i)while(i-);char scan_key1(void) if(key1=0) delay(100); if(key1=0) f_k1=0; return 0; else return 0; else if(f_k1=0) f_k1=1; return 1; else return 0; char scan_key2(void)if(key

18、2=0)delay(100);if(key2=0)f_k2=0;return 0;else return 0;else if(f_k2=0)f_k2=1;return 1;else return 0;char scan_key3(void)if(key3=0)delay(100);if(key3=0)f_k3=0;return 0;else return 0;else if(f_k3=0)f_k3=1;return 1;else return 0;char scan_key4(void)if(key4=0)delay(100);if(key4=0)f_k4=0;return 0;else re

19、turn 0;else if(f_k4=0)f_k4=1;return 1;else return 0;char scan_key5(void)if(key5=0)delay(100);if(key5=0)f_k5=0;return 0;else return 0;else if(f_k5=0)f_k5=1;return 1;else return 0;g an employment tribunal claiEmployment tribunals sort out disagreements between employers and employees.You may need to m

20、ake a claim to an employment tribunal if: you dont agree with the disciplinary action your employer has taken against you your employer dismisses you and you think that you have been dismissed unfairly.For more information about dismissal and unfair dismissal, seeDismissal.You can make a claim to an

21、 employment tribunal, even if you haventappealedagainst the disciplinary action your employer has taken against you. However, if you win your case, the tribunal may reduce any compensation awarded to you as a result of your failure to appeal.Remember that in most cases you must make an application t

22、o an employment tribunal within three months of the date when the event you are complaining about happened. If your application is received after this time limit, the tribunal will not usually accept i.If you are worried about how the time limits apply to you, take advice from one of the organisatio

23、ns listed underFurther help.Employment tribunals are less formal than some other courts, but it is still a legal process and you will need to give evidence under an oath or affirmation.Most people find making a claim to an employment tribunal challenging. If you are thinking about making a claim to

24、an employment tribunal, you should get help straight away from one of the organisations listed underFurther help.If you are being represented by a solicitor at the tribunal, they may ask you to sign an agreement where you pay their fee out of your compensation if you win the case. This is known as a

25、damages-based agreement. In England and Wales, your solicitor cant charge you more than 35% of your compensation if you win the case.If you are thinking about signing up for a damages-based agreement, you should make sure youre clear about the terms of the agreement. It might be best to get advice f

26、rom an experienced adviser, for example, at a Citizens Advice Bureau. To find your nearest CAB, including those that give advice by e-mail, click onnearest CAB.For more information about making a claim to an employment tribunal, seeEmployment tribunals.The (lack of) air up there Watch mCayman Island

27、s-based Webb, the head of Fifas anti-racism taskforce, is in London for the Football Associations 150th anniversary celebrations and will attend Citys Premier League match at Chelsea on Sunday.I am going to be at the match tomorrow and I have asked to meet Yaya Toure, he told BBC Sport.For me its ab

28、out how he felt and I would like to speak to him first to find out what his experience was.Uefa hasopened disciplinary proceedings against CSKAfor the racist behaviour of their fans duringCitys 2-1 win.Michel Platini, president of European footballs governing body, has also ordered an immediate inve

29、stigation into the referees actions.CSKA said they were surprised and disappointed by Toures complaint. In a statement the Russian side added: We found no racist insults from fans of CSKA.Age has reached the end of the beginning of a word. May be guilty in his seems to passing a lot of different lif

30、e became the appearance of the same day; May be back in the past, to oneself the paranoid weird belief disillusionment, these days, my mind has been very messy, in my mind constantly. Always feel oneself should go to do something, or write something. Twenty years of life trajectory deeply shallow, s

31、uddenly feel something, do it.一字開頭的年齡已經(jīng)到了尾聲?;蛟S是愧疚于自己似乎把轉(zhuǎn)瞬即逝的很多個不同的日子過成了同一天的樣子;或許是追溯過去,對自己那些近乎偏執(zhí)的怪異信念的醒悟,這些天以來,思緒一直很凌亂,在腦海中不斷糾纏??傆X得自己自己似乎應該去做點什么,或者寫點什么。二十年的人生軌跡深深淺淺,突然就感覺到有些事情,非做不可了。The end of our life, and can meet many things really do?而窮盡我們的一生,又能遇到多少事情是真正地非做不可?During my childhood, think lucky mone

32、y and new clothes are necessary for New Year, but as the advance of the age, will be more and more found that those things are optional; Junior high school, thought to have a crush on just means that the real growth, but over the past three years later, his writing of alumni in peace, suddenly found

33、 that isnt really grow up, it seems is not so important; Then in high school, think dont want to give vent to out your inner voice can be in the high school children of the feelings in a period, but was eventually infarction when graduation party in the throat, later again stood on the pitch he has

34、sweat profusely, looked at his thrown a basketball hoops, suddenly found himself has already cant remember his appearance.童年時,覺得壓歲錢和新衣服是過年必備,但是隨著年齡的推進,會越來越發(fā)現(xiàn),那些東西根本就可有可無;初中時,以為要有一場暗戀才意味著真正的成長,但三年過去后,自己心平氣和的寫同學錄的時候,突然就發(fā)現(xiàn)是不是真正的成長了,好像并沒有那么重要了;然后到了高中,覺得非要吐露出自己的心聲才能為高中生涯里的懵懂情愫劃上一個句點,但畢業(yè)晚會的時候最終還是被梗塞在了咽喉,后

35、來再次站在他曾經(jīng)揮汗如雨的球場,看著他投過籃球的球框時,突然間發(fā)現(xiàn)自己已經(jīng)想不起他的容顏。Originally, this world, can produce a chemical reaction to an event, in addition to resolutely, have to do, and time.原來,這個世界上,對某個事件能產(chǎn)生化學反應的,除了非做不可的堅決,還有,時間。A persons time, your ideas are always special to clear. Want, want, line is clear, as if nothing co

36、uld shake his. Also once seemed to be determined to do something, but more often is he backed out at last. Dislike his cowardice, finally found that there are a lot of love, there are a lot of miss, like shadow really have been doomed. Those who do, just green years oneself give oneself an arm injec

37、tion, or is a self-righteous spiritual.一個人的時候,自己的想法總是特別地清晰。想要的,不想要的,界限明確,好像沒有什么可以撼動自己。也曾經(jīng)好像已經(jīng)下定了決心去做某件事,但更多的時候是最后又打起了退堂鼓。嫌惡過自己的怯懦,最終卻發(fā)現(xiàn)有很多緣分,有很多錯過,好像冥冥之中真的已經(jīng)注定。那些曾經(jīng)所謂的非做不可,只是青蔥年華里自己給自己注射的一支強心劑,或者說,是自以為是的精神寄托罷了。At the moment, the sky is dark, the air is fresh factor after just rained. Suddenly though

38、t of blue plaid shirt; Those were broken into various shapes of stationery; From the corner at the beginning of deep friendship; Have declared the end of the encounter that havent start planning. Those years, those days of do, finally, like youth, will end in our life.此刻,天空是陰暗的,空氣里有著剛下過雨之后的清新因子。突然想到

39、那件藍格子襯衫;那些被折成各種各樣形狀的信紙;那段從街角深巷伊始的友誼;還有那場還沒有開始就宣告了終結(jié)的邂逅計劃那些年那些天的非做不可,終于和青春一樣,都將在我們的人生中謝幕。Baumgartner the disappointing news: Mission aborted. r plays an important role in this mission. Starting at the ground, conditions have to be very calm - winds less than 2 mph, with no precipitation or humidity a

40、nd limited cloud cover. The balloon, with capsule attached, will move through the lower level of the atmosphere (the troposphere) where our day-to-day weather lives. It will climb higher than the tip of Mount Everest (5.5 miles/8.85 kilometers), drifting even higher than the cruising altitude of com

41、mercial airliners (5.6 miles/9.17 kilometers) and into the stratosphere. As he crosses the boundary layer (called the tropopause),e can expect a lot of turbulence.The supersonic descent could happen as early as Sunda.The weatheThe balloon will slowly drift to the edge of space at 120,000 feet ( Then

42、, I would assume, he will slowly step out onto something resembling an Olympic diving platform.Below, the Earth becomes the concrete bottom of a swimming pool that he wants to land on, but not too hard. Still, hell be traveling fast, so despite the distance, it will not be like diving into the deep

43、end of a pool. It will be like he is diving into the shallow end. Skydiver preps for the big jumpWhen he jumps, he is expected to reach the speed of sound - 690 mph (1,110 kph) - in less than 40 seconds. Like hitting the top of the water, he will begin to slow as he approaches the more dense air clo

44、ser to Earth. But this will not be enough to stop him completely.If he goes too fast or spins out of control, he has a stabilization parachute that can be deployed to slow him down. His team hopes its not needed. Instead, he plans to deploy his 270-square-foot (25-square-meter) main chute at an alti

45、tude of around 5,000 feet (1,524 meters).In order to deploy this chute successfully, he will have to slow to 172 mph (277 kph). He will have a reserve parachute that will open automatically if he loses consciousness at mach speeds.Even if everything goes as planned, it wont. Baumgartner still will free fall at a speed that would cause you and me to pass out, and no parachute is guaranteed to work higher than 25,000 feet (7,620 meters).cause there17

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

相關(guān)資源

更多
正為您匹配相似的精品文檔
關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話:18123376007

備案號:ICP2024067431-1 川公網(wǎng)安備51140202000466號


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務(wù)平臺,本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請立即通知裝配圖網(wǎng),我們立即給予刪除!