畢業(yè)設計基于AT89C51單片機的籃電子球記分牌設計_第1頁
畢業(yè)設計基于AT89C51單片機的籃電子球記分牌設計_第2頁
畢業(yè)設計基于AT89C51單片機的籃電子球記分牌設計_第3頁
畢業(yè)設計基于AT89C51單片機的籃電子球記分牌設計_第4頁
畢業(yè)設計基于AT89C51單片機的籃電子球記分牌設計_第5頁
已閱讀5頁,還剩20頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、單片機課程設計報告冊設 計 題 目: 籃球賽電子記分牌 專 業(yè):指 導 教 師:姓 名:學 號:2012年12月摘 要隨著單片機在各個領域的廣泛應用,許多用單片機作控制的計時記分系統(tǒng)也應運而生,如用單片機控制lcd液晶顯示的計時記分器,用單片機控制led七段顯示的計時記分器等?;@球賽電子記分牌是根據籃球比賽特點設計的獨立的信息采集、分配、評判和顯示的系統(tǒng),能實現(xiàn)比賽分數(shù)的實時、準確、快捷處理和呈現(xiàn)。本設計原理簡單,主要采用at89c51單片機作為微控制器,集合數(shù)碼管和led指示燈,通過鍵盤控制記分牌的工作狀態(tài),通過數(shù)碼管和led指示燈來反饋信息的籃球賽記分系統(tǒng),并仿真實現(xiàn)。本設計在充分考慮了籃

2、球比賽的實際情況基礎上設計,該系統(tǒng)的數(shù)據顯示由兩個四位數(shù)碼來實現(xiàn),能顯示甲乙兩隊的比分情況,具有加分、減分、甲乙切換等功能。此外,該系統(tǒng)具有低功耗、可靠性、安全性以及低成本等特點,可廣泛用于學校和小團體作為賽程記分。具有一定的實用性。關鍵詞:單片機,at89c51,led數(shù)碼管,仿真,籃球記分牌目 錄第一章 設計任務與要求11.1 設計的目的和意義11.2 設計任務與要求1第二章 總體設計方案22.1 顯示模塊22.2 按鍵控制模塊22.3 指示模塊22.4 總體硬件組成框圖2第三章 硬件系統(tǒng)33.1 數(shù)碼管顯示模塊33.2 按鍵控制模塊43.3 led指示燈模塊53.4 單片機最小系統(tǒng)6第四

3、章 軟件系統(tǒng)74.1 主程序設計74.2 指示燈設計9第五章 系統(tǒng)調試與測試105.1 系統(tǒng)調試105.2 測試結果11結 論12參考文獻13附錄一 程序清單14附錄二 仿真全圖17附錄三 元件清單18第一章 設計任務與要求1.1 設計的目的和意義目前球場記分牌在傳統(tǒng)操作模式下,采用記分員手動翻動記分牌記分,工作方式單一。由于種種弊端,電子記分板已經開始在一些大型的體育場流行起來,不僅發(fā)展速度迅猛并會逐漸取代傳統(tǒng)的電子記分牌。電子記分板根據籃球比賽的特點,采用單片機為核心控制led數(shù)碼管,具有亮度高、可視性好、功耗小、使用壽命長等優(yōu)點;具有性能穩(wěn)定,尺寸適中,運輸安裝方式靈活,物美價廉等特點,

4、特別適用于小型籃球體育館和露天運動場。1.2 設計任務與要求l 設計題目:籃球賽電子記分牌 l 設計要求: (1)分別設計籃球比賽甲乙兩個隊的記分牌;(2)能實現(xiàn)兩張記分牌的切換;(3)能按照籃球賽記分規(guī)則記分并顯示;(4)將原有的一個指示燈基礎上進一步改進為兩個指示燈,作分別指示。第二章 總體設計方案本系統(tǒng)采用單片機at89c51為控制核心,系統(tǒng)主要包括顯示模塊、按鍵控制模塊、指示模塊等。 2.1 顯示模塊 采用七段碼數(shù)碼管顯示。數(shù)碼管是指將所有發(fā)光二極管的一極接到一起形成公共極,因此數(shù)碼管有共陰共陽之分。以共陽數(shù)碼管為例,共陽數(shù)碼管在應用時應將公共極接到+5v,當某一字段發(fā)光二極管的陰極為

5、低電平時,相應字段就點亮。當某一字段的陰極為高電平時,相應字段就不亮。因此每個數(shù)碼管有8個接口。根據其實際應用進行選擇。 2.2 按鍵控制模塊采用獨立按鍵。每個獨立按鍵與單片機i/o連接,雖然不能節(jié)省i/o口,但電路簡單、編程容易,由于本系統(tǒng)只需要五個按鍵,因此選者獨立按鍵。2.3 指示模塊 采用指示燈,在切換記分牌時起指示作用,能夠看得清楚明白。按鍵控制模塊at89c51數(shù)碼管顯示模塊led指示2.4 總體硬件組成框圖圖2-1第三章 硬件系統(tǒng)為使該電子記分牌更加方便和靈活,本設計將其劃分為三個模塊,下面將對各個模塊逐一介紹。3.1 數(shù)碼管顯示模塊數(shù)碼管也叫l(wèi)ed數(shù)碼管,它是一種專門用來顯示數(shù)

6、字的器件,led數(shù)碼管(led segment displays)是由多個發(fā)光二極管封裝在一起組成“8”字型的器件,引線已在內部連接完成,只需引出它們的各個筆劃,公共電極。led數(shù)碼管常用段數(shù)一般為7段有的另加一個小數(shù)點,還有一種是類似于3位“+1”型。位數(shù)有半位,1,2,3,4,5,6,8,10位等等.,led數(shù)碼管根據led的接法不同分為共陰和共陽兩類,了解led的這些特性,對編程是很重要的,因為不同類型的數(shù)碼管,除了它們的硬件電路有差異外,編程方法也是不同的。圖3-1數(shù)碼管顯示模塊電路3.2 按鍵控制模塊按鍵控制模塊采用4個獨立按鍵,ke1、k2、k3、k4、k5分別于單片機的p10、p

7、11、p12、p13、p17連接,每個按鍵的另一端直接與地相連接,因此是低電平有效。按鍵控制模塊的電路如圖3-2所示。這四個獨立按鍵分別實現(xiàn)了比賽兩只隊伍的得分值的改變。具體標號和功能如表3-1所示。 表3-1 按鍵功能描述序號接口功能k1p10加1分k2p11加2分k3p12加3分k4p13減1分k5p17甲乙互換圖3-2按鍵控制模塊電路圖3.3 led指示燈模塊led指示燈模塊由兩條電路r1與d1、r2與d2組成,分別接入單片機的p30、p31口,低電平有效。led指示燈模塊如圖3-3所示。圖3-3led指示燈模塊電路圖3.4 單片機最小系統(tǒng) at89c51是一種帶4k字節(jié)flash存儲器

8、(fperomflash programmable and erasable read only memory)的低電壓、高性能cmos 8位微處理器,俗稱單片機。at89c2051是一種帶2k字節(jié)閃存可編程可擦除只讀存儲器的單片機。單片機的可擦除只讀存儲器可以反復擦除1000次。該器件采用atmel高密度非易失存儲器制造技術制造,與工業(yè)標準的mcs-51指令集和輸出管腳相兼容。圖3-4最小系統(tǒng)模塊電路圖由于將多功能8位cpu和閃爍存儲器組合在單個芯片中,atmel的at89c51是一種高效微控制器。最小系統(tǒng)模塊的晶振電路由12mhz晶振和30pf的電容構成,復位電路由10uf的電解電容構成。

9、電路如圖3-4所示。第四章 軟件系統(tǒng)在本設計中,系統(tǒng)的軟件設計也采用了模塊化的設計,將系統(tǒng)的各部分功能編寫成子模塊的形式。4.1 主程序設計本系統(tǒng)中單片機的主要功能就是利用內部的定時器計時,并隨時接受按鍵控制模塊的信息,將比賽的得分顯示led數(shù)碼管上。k1、k2、k3鍵配合程序所設定的端口控制比賽的加分,開始時,當k1按下,甲隊加一分;當k2按下,加兩分;當k3按下,加三分;k4鍵配合程序所設定的端口控制比賽的減分,k4按下,減一分。程序流程如圖4-1所示。開始初始化選甲?隊?yesk1按鍵是否按下?nok2按鍵是否按下?將甲乙隊分數(shù)顯k3按鍵是否按下?no結束k4按鍵是否按下?no甲加1分y

10、esyes甲加2分yes甲加3分甲減1分k1按鍵是否按下?k2按鍵是否下?k3按鍵是否按下?k4按鍵是否按下?nonono乙加1分yesyes乙加2分yes乙加3分乙減1分nonoyesyes圖4-1主程序流程圖4.2 指示燈設計開始運行時,黃燈亮,表示選中了甲隊記分牌,當k5按下,綠燈亮,表示選中了乙隊記分牌。程序流程如圖4-2所示。yesno開始清零d1亮選中甲隊k5是否按下?d2亮選中乙隊顯示結束圖4-2指示燈設計流程圖 第五章 系統(tǒng)調試與測試5.1 系統(tǒng)調試 軟件調試采用keil軟件完成。在打開后,建新工程,選擇at89c51處理器,接著新建文檔編輯程序,編輯完存為.asm,把保存的.

11、asm文件加入到工程里。檢查無語法錯誤后生成.hex文件。程序清單查看附錄一。打開仿真軟件isis,找到與系統(tǒng)相關的元器件,將各個元器件的引腳連接,保存到程序所在文件夾,將程序加載到at89c51單片機上,開始運行仿真。(1)出現(xiàn)了以下問題,如圖5-1所示。圖5-1(2)發(fā)現(xiàn)問題,如圖5-2所示。圖5-2(3)解決問題后,如圖5-3所示。圖5-35.2 測試結果 本次系統(tǒng)設計結構較好,單片機最小系統(tǒng)能正常工作,經過調試發(fā)現(xiàn)問題并將問題解決后,按鍵模塊能實現(xiàn)控制功能,led數(shù)碼管顯示模塊能根據按鍵模塊輸入的控制信息進行顯示,指示燈模塊能按按鍵模塊輸入控制信息和程序設定的要求顯示。仿真結果全圖如附

12、錄二所示。 結 論本次基于單片機的籃球比賽電子記分牌是針對傳統(tǒng)籃球比賽人工翻動比分牌的改進,解決籃球比賽時計分與計時準確方便和靈活適用的問題。系統(tǒng)總體電路由單片機最小系統(tǒng)、led數(shù)碼管顯示模塊、5個獨立按鍵控制模塊led指示燈模塊構成。四個模塊分別完成信息的處理、顯示、控制等籃球比賽記分牌的基本功能。通過軟件的仿真調試,實現(xiàn)了本次設計的基本功能,左邊的數(shù)碼管顯示甲隊比賽的得分,右邊數(shù)碼管顯示乙隊比賽的得分。五個按鍵能完成程序的要求對比分的調整進行控制,指示燈在記分牌切換時發(fā)生變化,給予球員和觀眾指示。雖然調試成功,但是該記分牌功能過于單一,只能夠記分,不能滿足現(xiàn)代人們的需求,有待改進。為了使一

13、個系統(tǒng)能夠具備多種功能,以后可以將其進一步改進,根據籃球比賽的特點,讓這個系統(tǒng)能夠記分,也可以計時,蜂鳴器在規(guī)定的時間段鳴叫,給球員和觀眾提示。參考文獻1.單片機原理與應用技術/江力主編;蔡駿,王艷春,董澤芳副主編.北京:清華大學出版社,2006(2007重?。?.單片機課程設計指導/樓然苗,李光飛編著./-2版-北京:北京航空航天大學出版社,2012.1附錄一 程序清單 org 0000h ljmp main org 0030h;*;p0口接數(shù)碼管的段選(低電平有效);p2.0-p2.3接數(shù)碼管的位選(高電平有效);*main: mov p2,#0ffh mov p0,#0c0h mov r

14、2,#00 mov r1,#00 clr p3.0;* ;鍵盤掃描程序;*;=判斷甲乙間的轉換=chengxu: jb p1.7,jiayidui jnb p1.7,$ cpl p3.0 cpl p3.1jiayidui:jb p3.0,yiduiljmp jiaduijb p3.1,jiadui ljmp yidui;* ;甲 乙隊加減分判斷;*;=甲隊加1分程序=jiadui: jb p1.0,loop1 jnb p1.0,$ ljmp jia1;=甲隊加2分程序=loop1: jb p1.1,loop2 jnb p1.1,$ ljmp jia2;=甲隊加3分程序=loop2: jb p1

15、.2,loop3 jnb p1.2,$ inc r2 jia2:inc r2jia1:inc r2 cjne r2,#200,lp3 ljmp mainlp3: cjne r2,#201,lp4 ljmp mainlp4: cjne r2,#202,loop3 ljmp main;=甲隊減1分程序=loop3: jb p1.3,xianshi jnb p1.3,$ dec r2 cjne r2,#0ffh,xianshi ljmp main;=乙隊加1分程序=yidui: jb p1.0,loop4 jnb p1.0,$ ljmp jia3;=乙隊加2分程序=loop4: jb p1.1,lo

16、op5 jnb p1.1,$ ljmp jia4;=乙隊加3分程序=loop5: jb p1.2,loop6 jnb p1.2,$ inc r1 jia4:inc r1jia3:inc r1 cjne r1,#200,lp5 ljmp mainlp5: cjne r1,#201,lp6 ljmp mainlp6: cjne r1,#202,loop6 ljmp main;=乙隊減1分程序=loop6: jb p1.3,xianshi jnb p1.3,$ dec r1 cjne r2,#0ffh,xianshi ljmp main;* ;顯示程序;*;=甲隊顯示掃描=xianshi: mov

17、a,r2 mov b,#100 div ab lcall chabiao mov p2,#02h mov p0,a lcall delay mov p2,#00h mov a,b mov b,#10 div ab lcall chabiao mov p2,#04h mov p0,a lcall delay mov p2,#00h mov a,b lcall chabiao mov p2,#08h mov p0,a lcall delay mov p2,#00h;=乙隊顯示掃描= mov a,r1 mov b,#100 div ab lcall chabiao mov p2,#20h mov p

18、0,a lcall delay mov p2,#00h mov a,b mov b,#10 div ab lcall chabiao mov p2,#40h mov p0,a lcall delay mov p2,#00h mov a,b lcall chabiao mov p2,#80h mov p0,a lcall delay mov p2,#00h ljmp chengxu;跳轉到甲乙切換;*;延時20ms子程序;*delay: mov r5,#10loop: mov r6,#0ffh djnz r6,$ djnz r5,loop ret;*;查表指令;*chabiao: mov dpt

19、r,#0200h movc a,a+dptr ret;*;0-9共陽數(shù)碼管顯示表;* org 0200h db 0c0h,0f9h,0a4h,0b0h,99h db 92h,82h,0f8h,80h,90h end;*;結束程序;*附錄二 仿真全圖附錄三 元件清單序號名稱位號型號規(guī)格數(shù)量1電阻r1/r21002只2電阻r310k1只3瓷片電容c1/c230uf2只4電解電容c310uf1只5發(fā)光二極管(黃/綠)d1/d22只6npn三極管q1/q2/q3/q4/q5/q6/q7/q890148只7四位數(shù)碼管(紅/藍)共陽2只8單片機u1at89c511只9晶振x112mhz1只10單片機座子1

20、只11輕觸開關k1/k2/k3/k4/k5/電源開關四腳6只12導線0.5mm若干13萬用板34*541塊employment tribunals sort out disagreements between employers and employees.you may need to make 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

21、you think that you have been dismissed unfairly.for more information about dismissal and unfair dismissal, seedismissal.you can make a claim to an employment tribunal, even if you haventappealedagainst the disciplinary action your employer has taken against you. however, if you win your case, the tr

22、ibunal 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 to an employment tribunal within three months of the date when the event you are complaining about happened. if your application is received after this tim

23、e 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 organisations 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 evidenc

24、e 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 an employment tribunal, you should get help straight away from one of the organisations listed underfurther help.if you are being represented by a solicit

25、or 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 adamages-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 a

26、bout 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 from an experienced adviser, for example, at a citizens advice bureau. to find your nearest cab, including those that give advice by e-mail, click onneares

27、t cab.for more information about making a claim to an employment tribunal, seeemployment tribunals.the (lack of) air up there watch mcayman islands-based webb, the head of fifas anti-racism taskforce, is in london for the football associations 150th anniversary celebrations and will attend citys pre

28、mier 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 about 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 rac

29、ist behaviour of their fans duringcitys 2-1 win.michel platini, president of european footballs governing body, has also ordered an immediate investigation into the referees actions.cska said they were surprised and disappointed by toures complaint. in a statement the russian side added: we found no

30、 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 life 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

31、messy, in my mind constantly. always feel oneself should go to do something, or write something. twenty years of life trajectory deeply shallow, suddenly feel something, do it.一字開頭的年齡已經到了尾聲?;蛟S是愧疚于自己似乎把轉瞬即逝的很多個不同的日子過成了同一天的樣子;或許是追溯過去,對自己那些近乎偏執(zhí)的怪異信念的醒悟,這些天以來,思緒一直很凌亂,在腦海中不斷糾纏??傆X得自己自己似乎應該去做點什么,或者寫點什么。二十年

32、的人生軌跡深深淺淺,突然就感覺到有些事情,非做不可了。the end of our life, and can meet many things really do?而窮盡我們的一生,又能遇到多少事情是真正地非做不可?during my childhood, think lucky money 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 schoo

33、l, 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 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 scho

34、ol 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 sweat profusely, looked at his thrown a basketball hoops, suddenly found himself has already cant remember his appearance.童年時,覺得壓歲錢和新衣服是過年必備,但是隨著年齡的推進,會越來

35、越發(fā)現(xiàn),那些東西根本就可有可無;初中時,以為要有一場暗戀才意味著真正的成長,但三年過去后,自己心平氣和的寫同學錄的時候,突然就發(fā)現(xiàn)是不是真正的成長了,好像并沒有那么重要了;然后到了高中,覺得非要吐露出自己的心聲才能為高中生涯里的懵懂情愫劃上一個句點,但畢業(yè)晚會的時候最終還是被梗塞在了咽喉,后來再次站在他曾經揮汗如雨的球場,看著他投過籃球的球框時,突然間發(fā)現(xiàn)自己已經想不起他的容顏。originally, this world, can produce a chemical reaction to an event, in addition to resolutely, have to do, a

36、nd time.原來,這個世界上,對某個事件能產生化學反應的,除了非做不可的堅決,還有,時間。a persons time, your ideas are always special to clear. want, want, line is clear, as if nothing could 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

37、 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 injection, or is a self-righteous spiritual.一個人的時候,自己的想法總是特別地清晰。想要的,不想要的,界限明確,好像沒有什么可以撼動自己。也曾經好像已經下定了決心去做某件事,但更多的時候是最后又打起了退堂鼓。嫌惡過自己的怯懦,最終卻發(fā)現(xiàn)有很多緣分,有很多錯過,好像冥冥之中真

38、的已經注定。那些曾經所謂的非做不可,只是青蔥年華里自己給自己注射的一支強心劑,或者說,是自以為是的精神寄托罷了。at the moment, the sky is dark, the air is fresh factor after just rained. suddenly thought 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

39、the encounter that havent start planning. those years, those days of do, finally, like youth, will end in our life.此刻,天空是陰暗的,空氣里有著剛下過雨之后的清新因子。突然想到那件藍格子襯衫;那些被折成各種各樣形狀的信紙;那段從街角深巷伊始的友誼;還有那場還沒有開始就宣告了終結的邂逅計劃那些年那些天的非做不可,終于和青春一樣,都將在我們的人生中謝幕。baumgartner the disappointing news: mission aborted. r plays an im

40、portant role in this mission. starting at the ground, conditions have to be very calm - winds less than 2 mph, with no precipitation or humidity and limited cloud cover. the balloon, with capsule attached, will move through the lower level of the atmosphere (the troposphere) where our day-to-day wea

41、ther 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 commercial 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

溫馨提示

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

評論

0/150

提交評論