單片機(jī)技術(shù)課程設(shè)計(jì)報(bào)告(籃球計(jì)時(shí)計(jì)分器)(共43頁(yè))_第1頁(yè)
單片機(jī)技術(shù)課程設(shè)計(jì)報(bào)告(籃球計(jì)時(shí)計(jì)分器)(共43頁(yè))_第2頁(yè)
單片機(jī)技術(shù)課程設(shè)計(jì)報(bào)告(籃球計(jì)時(shí)計(jì)分器)(共43頁(yè))_第3頁(yè)
單片機(jī)技術(shù)課程設(shè)計(jì)報(bào)告(籃球計(jì)時(shí)計(jì)分器)(共43頁(yè))_第4頁(yè)
單片機(jī)技術(shù)課程設(shè)計(jì)報(bào)告(籃球計(jì)時(shí)計(jì)分器)(共43頁(yè))_第5頁(yè)
已閱讀5頁(yè),還剩46頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、課設(shè)報(bào)告福建工程學(xué)院軟件(run jin)學(xué)院題 目: 基于單片機(jī)的籃球(lnqi)計(jì)時(shí)計(jì)分器班 級(jí): 物聯(lián)網(wǎng)(lin wn)2班姓 名: 孫建興學(xué) 號(hào): 3112113229指導(dǎo)老師: 鄭旭丹日 期: 2013 年 12 月 24 日 目錄(ml)TOC o 1-3 h u HYPERLINK l _Toc16619 1摘要(zhiyo) PAGEREF _Toc16619 3 HYPERLINK l _Toc27006 2設(shè)計(jì)(shj)要求 PAGEREF _Toc27006 3 HYPERLINK l _Toc8526 2.1功能需求 PAGEREF _Toc8526 3 HYPERLI

2、NK l _Toc16756 2.2設(shè)計(jì)要求 PAGEREF _Toc16756 4 HYPERLINK l _Toc13749 3硬件設(shè)計(jì)及描述 PAGEREF _Toc13749 4 HYPERLINK l _Toc6280 3.1總體描述 PAGEREF _Toc6280 4 HYPERLINK l _Toc14399 3.2系統(tǒng)總體框圖 PAGEREF _Toc14399 12 HYPERLINK l _Toc11191 3.3Proteus電路圖 PAGEREF _Toc11191 12 HYPERLINK l _Toc6120 3.4各部分硬件介紹 PAGEREF _Toc6120

3、 13 HYPERLINK l _Toc1081 4軟件設(shè)計(jì)流程及描述 PAGEREF _Toc1081 14 HYPERLINK l _Toc24204 4.1程序流程圖 PAGEREF _Toc24204 14 HYPERLINK l _Toc7156 4.2函數(shù)模塊及功能 PAGEREF _Toc7156 15 HYPERLINK l _Toc16390 5功能實(shí)現(xiàn)(功能介紹+照片) PAGEREF _Toc16390 16 HYPERLINK l _Toc15006 6心得體會(huì) PAGEREF _Toc15006 17 HYPERLINK l _Toc25434 7源程序 PAGERE

4、F _Toc25434 171摘要本文主要內(nèi)容(nirng)是利用AT89C51單片機(jī)與160*128的液晶組合(zh)設(shè)計(jì)的籃球計(jì)時(shí)計(jì)分器,在像素為160*128的液晶上顯示時(shí)間,分?jǐn)?shù),節(jié)次等信息,并可通過(guò)按鍵來(lái)加分,暫停時(shí)間,攻守方互換,進(jìn)入下一節(jié)等操作(cozu)。本課題是基于單片機(jī)技術(shù)和160*128的廣泛應(yīng)用而提出。本次做的籃球計(jì)時(shí)計(jì)分器是以單片機(jī)為核心,結(jié)合PG160128ALCD 顯示器,再配以相應(yīng)的軟件,達(dá)到實(shí)現(xiàn)模擬籃球計(jì)時(shí)計(jì)分的目的. 近年來(lái)隨著計(jì)算機(jī)在社會(huì)領(lǐng)域的滲透和大規(guī)模集成電路的發(fā)展,單片機(jī)的應(yīng)用正在不斷地走向深入,由于它具有功能強(qiáng),體積小,功耗低,價(jià)格便宜,工作可靠,

5、使用方便等特點(diǎn),因此特別適合于與控制有關(guān)的系統(tǒng),越來(lái)越廣泛地應(yīng)用于自動(dòng)控制,智能化儀器,儀表,數(shù)據(jù)采集,軍工產(chǎn)品以及家用電器等各個(gè)領(lǐng)域,單片機(jī)往往是作為一個(gè)核心部件來(lái)使用,在根據(jù)具體硬件結(jié)構(gòu),以及針對(duì)具體應(yīng)用對(duì)象特點(diǎn)的軟件結(jié)合,以作完善。 單片機(jī)應(yīng)用的重要意義在于,它從根本上改變了傳統(tǒng)的控制系統(tǒng)設(shè)計(jì)思想和設(shè)計(jì)方法。從前必須由模擬電路或數(shù)字電路實(shí)現(xiàn)的大部分功能,現(xiàn)在已能用單片機(jī)通過(guò)軟件方法來(lái)實(shí)現(xiàn)了。這種軟件代替硬件的控制技術(shù)也稱為微控制技術(shù),是傳統(tǒng)控制技術(shù)的一次革命。 利用單片機(jī)實(shí)現(xiàn)的籃球計(jì)時(shí)計(jì)分器是單片機(jī)與PG160128A的組合應(yīng)用,可以很好得模擬常見(jiàn)的籃球計(jì)時(shí)計(jì)分,對(duì)于開(kāi)發(fā)單片機(jī)更深層次應(yīng)

6、用有非?,F(xiàn)實(shí)的意義。2設(shè)計(jì)要求要求能夠在160128LCD上顯示隊(duì)伍名稱,各隊(duì)得分,節(jié)次,每節(jié)剩余時(shí)間,24秒進(jìn)攻時(shí)間計(jì)時(shí),比賽狀態(tài),以及通過(guò)按鍵加分,暫停時(shí)間,攻守方互換,進(jìn)入下一節(jié)等操作,還要通過(guò)蜂鳴器表現(xiàn)節(jié)次結(jié)束,24秒進(jìn)攻時(shí)間結(jié)束,比賽結(jié)束時(shí)的笛聲。2.1功能需求信息顯示,包括:隊(duì)伍名稱,比賽狀態(tài),進(jìn)攻方,兩隊(duì)得分,節(jié)次,節(jié)次剩余時(shí)間,24秒進(jìn)攻時(shí)間剩余時(shí)間。按鍵,包括:加1分,加2分,加3分,啟動(dòng)、暫停,復(fù)位,下一節(jié),A隊(duì)進(jìn)攻,B隊(duì)進(jìn)攻,8個(gè)按鍵的功能實(shí)現(xiàn)。對(duì)進(jìn)攻方的加分,攻守方互換時(shí)進(jìn)攻時(shí)間的重置,進(jìn)攻時(shí)間結(jié)束時(shí)攻守方互換等算法實(shí)現(xiàn)。節(jié)次結(jié)束,24秒進(jìn)攻時(shí)間結(jié)束,比賽結(jié)束時(shí)的笛聲。

7、2.2設(shè)計(jì)(shj)要求通過(guò)(tnggu)160128LCD顯示各種計(jì)分計(jì)時(shí)信息。通過(guò)控制鍵實(shí)現(xiàn):加1分,加2分,加3分,啟動(dòng)、暫停,復(fù)位,下一節(jié),A隊(duì)進(jìn)攻(jngng),B隊(duì)進(jìn)攻,8個(gè)按鍵功能。3硬件設(shè)計(jì)及描述3.1總體描述系統(tǒng)硬件電路圖如下圖3-1所示:圖3-1硬件整體結(jié)構(gòu)圖系統(tǒng)的主要芯片包括Atmel公司的8位單片機(jī)AT89C51,PG60128ALCD,蜂鳴器以及一個(gè)八個(gè)按鍵組成。下面將對(duì)這些芯片分別予以介紹。3.1.1 AT89C51單片機(jī)簡(jiǎn)介STC是美國(guó)公司生產(chǎn)的低電壓,高性能CMOS8位單片機(jī),片內(nèi)含4k bytes的可反復(fù)擦寫的只讀程序存儲(chǔ)器(PEROM)和128 bytes的

8、隨機(jī)存取數(shù)據(jù)存儲(chǔ)器(RAM),器件采用ATMEL公司的高密度、非易失性存儲(chǔ)技術(shù)生產(chǎn),兼容標(biāo)準(zhǔn)MCS-51指令系統(tǒng),片內(nèi)置通用8位中央處理器(CPU)和Flash存儲(chǔ)單元,可靈活應(yīng)用于各種控制領(lǐng)域。圖3-2單片機(jī)引腳圖主要(zhyo)特性與MCS-51產(chǎn)品指令系統(tǒng)完全(wnqun)兼容4k字節(jié)(z ji)可重擦寫Flash閃速存儲(chǔ)器1000次擦寫周期全靜態(tài)操作:0Hz24MHz三級(jí)加密程序存儲(chǔ)器1288字節(jié)內(nèi)部RAM32個(gè)可編程IO口線2個(gè)16位定時(shí)計(jì)數(shù)器6個(gè)中斷源可編程串行UART通道低功耗空閑和掉電模式 AT89C51 提供以下標(biāo)準(zhǔn)功能:4k 字節(jié)Flash 閃速存儲(chǔ)器,128字節(jié)內(nèi)部RAM

9、,32 個(gè)IO 口線,兩個(gè)16位定時(shí)計(jì)數(shù)器,一個(gè)5向量?jī)杉?jí)中斷結(jié)構(gòu),一個(gè)全雙工串行通信口,片內(nèi)振蕩器及時(shí)鐘電路。同時(shí),AT89C51可降至0Hz的靜態(tài)邏輯操作,并支持兩種軟件可選的節(jié)電工作模式??臻e方式停止CPU的工作,但允許RAM,定時(shí)計(jì)數(shù)器,串行通信口及中斷系統(tǒng)繼續(xù)工作。掉電方式保存RAM中的內(nèi)容,但振蕩器停止工作并禁止其它所有部件工作直到下一個(gè)硬件復(fù)位。2.管腳說(shuō)明Vcc:電源電壓GND:地P0 :P0 口是一組8 位漏極開(kāi)路(kil)型雙向IO 口,也即地址數(shù)據(jù)總線復(fù)用口。作為輸出(shch)口用時(shí),每位能吸收電流的方式驅(qū)動(dòng)8個(gè)TTL邏輯(lu j)門電路,對(duì)端口寫“1”可作為高阻抗輸

10、入端用。在訪問(wèn)外部數(shù)據(jù)存儲(chǔ)器或程序存儲(chǔ)器時(shí),這組口線分時(shí)轉(zhuǎn)換地址(低8位)和數(shù)據(jù)總線復(fù)用,在訪問(wèn)期間激活內(nèi)部上拉電阻。在FIash編程時(shí),P0口接收指令字節(jié),而在程序校驗(yàn)時(shí),輸出指令字節(jié),校驗(yàn)時(shí),要求外接上拉電阻。P1 :P1是一個(gè)帶內(nèi)部上拉電阻的8位雙向IO口,P1的輸出緩沖級(jí)可驅(qū)動(dòng)(吸收或輸出電流)4個(gè)TTL邏輯門電路。對(duì)端口寫“1”,通過(guò)內(nèi)部的上拉電阻把端口拉到高電平,此時(shí)可作輸入口。作輸入口使用時(shí),因?yàn)閮?nèi)部存在上拉電阻,某個(gè)引腳被外部信號(hào)拉低時(shí)會(huì)輸出一個(gè)電流(IIL)。Flash編程和程序校驗(yàn)期間,P1接收低8位地址。P2 :P2是一個(gè)帶有內(nèi)部上拉電阻的8位雙向IO口,P2的輸出緩沖級(jí)

11、可驅(qū)動(dòng)(吸收或輸出電流)4個(gè)TTL邏輯門電路。對(duì)端口寫“1”,通過(guò)內(nèi)部的上拉電阻把端口拉到高電平,此時(shí)可作輸入口,作輸入口使用時(shí),因?yàn)閮?nèi)部存在上拉電阻,某個(gè)引腳被外部信號(hào)拉低時(shí)會(huì)輸出一個(gè)電流(IIL)。在訪問(wèn)外部程序存儲(chǔ)器或16位地址的外部數(shù)據(jù)存儲(chǔ)器(例如執(zhí)行MOVXDPTR指令)時(shí),P2口送出高8位地址數(shù)據(jù)。在訪問(wèn)8 位地址的外部數(shù)據(jù)存儲(chǔ)器(如執(zhí)行MOVXRI 指令)時(shí),P2 口線上的內(nèi)容(也即特殊功能寄存器(SFR)區(qū)中R2寄存器的內(nèi)容),在整個(gè)訪問(wèn)期間不改變。Flash編程或校驗(yàn)時(shí),P2亦接收高位地址和其它控制信號(hào)。P3: P3口是一組帶有內(nèi)部上拉電阻的8 位雙向IO 口。P3 口輸出緩

12、沖級(jí)可驅(qū)動(dòng)(吸收或輸出電流)4 個(gè)TTL邏輯門電路。對(duì)P3 口寫入“1”時(shí),它們被內(nèi)部上拉電阻拉高并可作為輸入端口。作輸入端時(shí),被外部拉低的P3 口將用上拉電阻輸出電流(IIL)。P3口除了作為一般的IO口線外,更重要的用途是它的第二功能,如下表所示:P3.0 RXD(串行輸入口) P3.1 TXD(串行輸出口) P3.2 /INT0(外部中斷0) P3.3 /INT1(外部中斷1) P3.4 T0(記時(shí)器0外部輸入) P3.5 T1(記時(shí)器1外部輸入) P3.6 /WR(外部數(shù)據(jù)存儲(chǔ)器寫選通) P3.7 /RD(外部數(shù)據(jù)存儲(chǔ)器讀選通) P3口同時(shí)為閃爍編程和編程校驗(yàn)接收一些控制信號(hào)。RST:

13、復(fù)位輸入。當(dāng)振蕩器復(fù)位器件時(shí),要保持RST腳兩個(gè)機(jī)器周期的高電平時(shí)間。 ALE/PROG:當(dāng)訪問(wèn)外部存儲(chǔ)器時(shí),地址鎖存允許的輸出電平用于鎖存地址的地位字節(jié)。在FLASH編程期間,此引腳用于輸入編程脈沖。在平時(shí),ALE端以不變的頻率周期輸出正脈沖信號(hào),此頻率為振蕩器頻率的1/6。因此它可用作對(duì)外部輸出的脈沖或用于定時(shí)目的。然而要注意的是:每當(dāng)用作外部數(shù)據(jù)存儲(chǔ)器時(shí),將跳過(guò)一個(gè)ALE脈沖。如想禁止ALE的輸出可在SFR8EH地址上置0。此時(shí), ALE只有在執(zhí)行MOVX,MOVC指令是ALE才起作用。另外,該引腳被略微拉高。如果微處理器在外部執(zhí)行狀態(tài)ALE禁止,置位無(wú)效。 /PSEN:外部程序存儲(chǔ)器的

14、選通信(tng xn)號(hào)。在由外部程序存儲(chǔ)器取指期間,每個(gè)機(jī)器周期兩次/PSEN有效(yuxio)。但在訪問(wèn)外部數(shù)據(jù)存儲(chǔ)器時(shí),這兩次有效的/PSEN信號(hào)(xnho)將不出現(xiàn)。 /EA/VPP:當(dāng)/EA保持低電平時(shí),則在此期間外部程序存儲(chǔ)器(0000H-FFFFH),不管是否有內(nèi)部程序存儲(chǔ)器。注意加密方式1時(shí),/EA將內(nèi)部鎖定為RESET;當(dāng)/EA端保持高電平時(shí),此間內(nèi)部程序存儲(chǔ)器。在FLASH編程期間,此引腳也用于施加12V編程電源(VPP)。 XTAL1:反向振蕩放大器的輸入及內(nèi)部時(shí)鐘工作電路的輸入。 XTAL2:來(lái)自反向振蕩器的輸出。AT89C5l 中有一個(gè)用于構(gòu)成內(nèi)部振蕩器的高增益反相放

15、大器,引腳XTAL1 和XTAL2 分別是該放大器的輸入端和輸出端。這個(gè)放大器與作為反饋元件的片外石英晶體或陶瓷諧振器一起構(gòu)成自激振蕩器,振蕩電路。3.1.2 PG160128LCD簡(jiǎn)介PG160128LCD是像素可尋址的圖形液晶顯示屏模塊芯片特性160 X 128 字符顯示點(diǎn)陣;并行 8 線數(shù)據(jù)通信;白色點(diǎn)陣,藍(lán)色背景,獨(dú)立LED背光電源;工作溫度寬, 工業(yè)級(jí) LCM, 超薄外型設(shè)計(jì)。2.操作說(shuō)明圖3-3 PG160128引腳說(shuō)明(shumng)圖3-4 PG160128內(nèi)部結(jié)構(gòu)及時(shí)(jsh)序圖圖3-5 讀數(shù)據(jù)時(shí)序(sh x)圖與讀/寫時(shí)間表圖3-6 設(shè)置(shzh)顯示起始說(shuō)明3.2系統(tǒng)

16、(xtng)總體框圖 單片機(jī)復(fù)位、晶振電路PG160128ALCD液晶顯示模塊蜂鳴器AT89C51 單片機(jī)按鍵中斷(8個(gè)獨(dú)立鍵盤)圖3.1總體(zngt)框圖3.3Proteus電路圖圖3.2Proteus電路圖3.4各部分硬件(yn jin)介紹PG160128ALCD液晶顯示模塊(m kui): 圖3.3液晶顯示模塊(m kui)2、通過(guò)控制鍵實(shí)現(xiàn):加1分,加2分,加3分,啟動(dòng)、暫停,復(fù)位(f wi),下一節(jié),A隊(duì)進(jìn)攻,B隊(duì)進(jìn)攻,8個(gè)按鍵功能。圖3.4獨(dú)立鍵盤(jinpn)模塊4軟件設(shè)計(jì)流程(lichng)及描述4.1程序(chngx)流程圖圖4.1程序(chngx)流程圖4.2函數(shù)模塊及

17、功能1、uchar Status_BIT_01(); / 狀態(tài)位STA1,STA0判斷(讀寫指令和讀寫數(shù)據(jù))2、uchar Status_BIT_3(); / 狀態(tài)位ST3判斷(數(shù)據(jù)自動(dòng)寫狀態(tài))3、uchar LCD_Write_Command_P2(uchar cmd,uchar para1,uchar para2); / 寫雙參數(shù)的指令4、uchar LCD_Write_Command_P1(uchar cmd,uchar Para1); / 寫單參數(shù)的指令5、uchar LCD_Write_Command(uchar cmd); / 寫無(wú)參數(shù)的指令6、uchar LCD_Write_Da

18、ta(uchar dat); / 寫數(shù)據(jù)7、uchar LCD_Read_Data(); / 讀數(shù)據(jù)8、void Set_LCD_POS(uchar row, uchar col) reentrant;/ 設(shè)置當(dāng)前地址功能說(shuō)9、void cls(); / 清屏10、uchar LCD_Initialise(); / LCM 初始化明11、uchar Display_Str_at_xy(uchar x,uchar y,char *fmt,uchar wb) reentrant;/ ASCII(8*16) 及 漢字(16*16) 顯示函數(shù)12、void OutToLCD(uchar Dat,uch

19、ar x,uchar y);/顯示輔助函數(shù)13、void Line( unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, uchar Mode) reentrant;/在指定位置畫線14、void Pixel(unsigned char PointX,unsigned char PointY, uchar Mode); /在指定坐標(biāo)畫點(diǎn)15、void Show_Score_A(); /*功能:顯示(xinsh)A隊(duì)得分。變量(binling):dat_str14,用于存取A隊(duì)分?jǐn)?shù)。參 數(shù): 無(wú)。返 回

20、值:無(wú)。調(diào)用函數(shù):Display_Str_at_xy(),顯示(xinsh)A隊(duì)分?jǐn)?shù)在指定位置。*/ void show_Score_B();/顯示B隊(duì)得分/*功能:顯示B隊(duì)得分。變量:dat_str14,用于存取B隊(duì)分?jǐn)?shù)。參 數(shù): 無(wú)。返 回 值:無(wú)。調(diào)用函數(shù):Display_Str_at_xy(),顯示B隊(duì)分?jǐn)?shù)在指定位置。*/ void show_Section();/*功能:顯示節(jié)次。變量:dat_str12,用于存取節(jié)次。參 數(shù): 無(wú)。返 回 值:無(wú)。調(diào)用函數(shù):Display_Str_at_xy(),顯示節(jié)次在指定位置。5功能實(shí)現(xiàn)(功能介紹+照片)1、計(jì)分器計(jì)時(shí)計(jì)分界面。圖5.1 計(jì)分

21、器計(jì)時(shí)計(jì)分界面6心得體會(huì)通過(guò)本次課程設(shè)計(jì)增加了我對(duì)單片機(jī)各模塊功能的了解。實(shí)驗(yàn)過(guò)程讓我更加了解并進(jìn)一步掌握(zhngw)了中斷,定時(shí)計(jì)數(shù),鍵盤等程序編寫。以及更加懂得了通過(guò)Proteus構(gòu)造自己所需要的外圍電路,進(jìn)行仿真實(shí)驗(yàn)。單片機(jī)應(yīng)用系統(tǒng)中,通常需要人機(jī)對(duì)話功能,能夠隨時(shí)發(fā)出各種控制命令(mng lng)和輸入數(shù)據(jù),報(bào)告應(yīng)用系統(tǒng)的運(yùn)行狀態(tài)與結(jié)果。該系統(tǒng)設(shè)計(jì)能夠很實(shí)用得簡(jiǎn)單模擬籃球計(jì)時(shí)計(jì)分效果具有較高的可用性。還可以通過(guò)修改程序,增加加時(shí)賽更好的完善該系統(tǒng)。液晶顯示技術(shù)的普及應(yīng)用和發(fā)展,給儀器、設(shè)備的小型化及智能化帶來(lái)了光輝的前景,特別是點(diǎn)陣圖形式液晶顯示模塊,它具有體積小、重量輕、低電壓、底

22、功耗之優(yōu)點(diǎn),因而在顯示內(nèi)容和顯示功能等方面表現(xiàn)出了獨(dú)特的性能。由于液晶顯示器已成為日常工作(gngzu)和生活中各種顯示儀器、儀表、和袖珍電子產(chǎn)品的重要組成部分,因此對(duì)于點(diǎn)陣圖形液晶顯示器件(模塊)的開(kāi)發(fā)、設(shè)計(jì)、應(yīng)用和研究對(duì)于將來(lái)的從事有關(guān)液晶顯示技術(shù)方面的工作具有重要意義。7源程序/*籃球計(jì)分計(jì)時(shí)器.c*/#include #include #include #include #include #include LCD_160128.hextern uchar LCD_Initialise();extern uchar LCD_Write_Command(uchar cmd);extern

23、uchar LCD_Write_Command_P1(uchar cmd,uchar paral);extern uchar LCD_Write_Command_P2(uchar cmd,uchar paral,uchar para2);extern uchar LCD_Write_Data(uchar dat);extern void Pixel(uchar x,uchar y, uchar Mode);extern void Set_LCD_POS(uchar row,uchar col) reentrant;extern void Line(uchar x1,uchar y1,uchar

24、 x2,uchar y2,uchar Mode) reentrant;/以上在中斷中也有用到所以定義為可重入函數(shù)extern void Draw_Image(uchar *G_Buffer,uchar Start_Row,uchar Start_Col)reentrant;extern void Display_Str_at_xy(uchar x,uchar y,char *Buffer,uchar wb) reentrant;extern void cls();sbit buzzer=P33;sbit Add_1=P10;sbit Add_2=P11;sbit Add_3=P12;sbit

25、A_attack=P13;sbit start_or_stop=P14;sbit B_attack=P15;sbit reset=P16;sbit next_section=P17;int A_Score=0,B_Score=0;uchar section=1,MM=12,Last_MM=0,SS=0,Last_SS=0,team=0,A_time=24,Last_A_time=0,B_time=24,Last_B_time=0,count=0,status=0;void delay(uint ms)uchar i;while (-ms)for(i=0;i120;i+); void sound

26、er(uchar t) uchar i,j; for(i = 0;i150;i+) buzzer=buzzer; for(j = 0;jt;j+); /顯示(xinsh)A隊(duì)得分void Show_Score_A()char dat_str14 = 0,0,0,0;dat_str10 = A_Score / 100+ 0;dat_str11 = (A_Score % 100) / 10+ 0;dat_str12 = A_Score % 10+ 0;Display_Str_at_xy(26,24,dat_str1,0); /顯示(xinsh)B隊(duì)得分void show_Score_B() cha

27、r dat_str14 = 0,0,0,0;dat_str10 = B_Score / 100+ 0;dat_str11 = (B_Score % 100) / 10+ 0;dat_str12 = B_Score % 10+ 0;Display_Str_at_xy(102,24,dat_str1,0); /顯示(xinsh)節(jié)次void show_Section() char dat_str12 = 0,0;dat_str10 = section % 10+ 0;Display_Str_at_xy(66,46,dat_str1,0); /顯示(xinsh)節(jié)次剩余時(shí)間void show_sec

28、tion_time() char dat_str13 = 0,0,0;if(SS!=Last_SS)Last_SS=SS;dat_str10 = SS / 10+ 0;dat_str11 = SS % 10+ 0;Display_Str_at_xy(114,68,dat_str1,0);if(MM!=Last_MM) Last_MM=MM;dat_str10 = MM / 10+ 0;dat_str11 = MM % 10+ 0;Display_Str_at_xy(90,68,dat_str1,0); void show_attack_time()char dat_str13 = 0,0,0;

29、 /顯示(xinsh)A對(duì)進(jìn)攻剩余時(shí)間if(team=0)if(A_time!=Last_A_time)Last_A_time=A_time; dat_str10 = A_time / 10+ 0;dat_str11 = A_time % 10+ 0;Display_Str_at_xy(90,112,dat_str1,0);sounder(80); /顯示(xinsh)B對(duì)進(jìn)攻剩余時(shí)間else if(B_time!=Last_B_time)Last_B_time=B_time; dat_str10 = B_time / 10+ 0;dat_str11 = B_time % 10+ 0;Disp

30、lay_Str_at_xy(90,112,dat_str1,0);sounder(80);/顯示(xinsh)進(jìn)攻方void show_attacker() if(team=0) Display_Str_at_xy(74,90,A,0); else Display_Str_at_xy(74,90,B,0);/顯示(xinsh)狀態(tài)void show_status() if(status=0) Display_Str_at_xy(117,46,暫停 ,1); elseDisplay_Str_at_xy(117,46,進(jìn)行中,1);void show_maker()Display_Str_at_x

31、y(26,2,單片機(jī)程序設(shè)計(jì),0);Display_Str_at_xy(35,24,籃球計(jì)分計(jì)時(shí)器,0);Display_Str_at_xy(39,46,物聯(lián)網(wǎng)1102班,0);Display_Str_at_xy(20,68,制作者:游建南,吳華榕,0);Display_Str_at_xy(20,90,福建工程學(xué)院軟件學(xué)院,0);Display_Str_at_xy(46,112,2013/12/8,0); /畫主菜單(ci dn)void Draw_Menu_UI()Line(0,0,159,0,1);Line(159,0,159,127,1);Line(159,127,0,127,1);Li

32、ne(0,127,0,0,1);Display_Str_at_xy(30,2,A隊(duì),0);Display_Str_at_xy(106,2,B隊(duì),0);Show_Score_A();Display_Str_at_xy(76,24,:,0);Show_Score_B();Display_Str_at_xy(2,46,當(dāng)前(dngqin)節(jié)次:,0);show_Section();Display_Str_at_xy(75,46, 狀態(tài)(zhungti):,0);Display_Str_at_xy(117,46,暫停,1);Display_Str_at_xy(2,68,本節(jié)剩余時(shí)間:,0);Displ

33、ay_Str_at_xy(90,68,12,0);Display_Str_at_xy(106,68,:,0);Display_Str_at_xy(114,68,00,0);Display_Str_at_xy(2,90,當(dāng)前進(jìn)攻方:,0);Display_Str_at_xy(74,90,A,0);Display_Str_at_xy(2,112,進(jìn)攻剩余時(shí)間:,0);Display_Str_at_xy(90,112,24,0);/* 按鍵檢測(cè)*/ void check_key()uchar score=0;/加分if(Add_1=0|Add_2=0|Add_3=0)&status=1) if(Ad

34、d_1=0) score=1; else if(Add_2=0) score=2; else if(Add_3=0) score=3; if(team=0) A_Score+=score;Show_Score_A();status=0;team=1;ET0 = 0; TR0 = 0;show_status(); else if(team=1) B_Score+=score;Show_Score_B();status=0;team=0;ET0 = 0; TR0 = 0;show_status();A_time=24;B_time=24; /下一節(jié)if(next_section=0§ion

35、38)count=0;if(SS=0) if(MM=0) next_section=0; for(i=0;i25;i+)sounder(80);delay(5); a+; else SS=59; MM-; elseSS-;if(team=0)if(A_time1)start_or_stop=0;team=1;A_time=24;B_time=24;for(i=0;i25;i+)sounder(80);delay(5);a+;elseA_time-; else if(team=1)if(B_time1)start_or_stop=0;team=0;A_time=24;B_time=24;for(

36、i=0;i25;i+)sounder(80);delay(5);a+;elseB_time-; if(a=0) ET0 = 1; TR0 = 1;void main()LCD_Initialise();buzzer=0;show_maker();while(1)if(start_or_stop=0)break;cls();Draw_Menu_UI();TMOD = 0 x01;TH0 = 0 x3C;TL0 = 0 xB0;ET0 = 0; TR0 = 0;EA = 1;while(1)check_key();show_section_time();show_attack_time();/*L

37、CD_160128.c*/#include #include #include #include #include #include #include #define LCMDW XBYTE0 x8000#define LCMCW XBYTE0 x8100#define ASC_CHR_WIDTH 8 #define ASC_CHR_HEIGHT 12 #define HZ_CHR_HEIGHT 12 #define HZ_CHR_WIDTH 12 sbit RESET=P33;uchar code LCD_WIDTH = 20; uchar code LCD_HEIGHT = 128; uc

38、har code ASC_MSK96*12= 0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 xff,0 xff,0 xff,0 xff,0 xff, 0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,/ 0 x00,0 x30,0 x78,0 x78,0 x78,0 x30,0 x30,0 x00,0 x30,0 x30,0 x00,0 x00,/ ! 0 x00,0 x66,0 x66,0 x66,0 x24,0 x00,0 x00,0 x00,0 x00,

39、0 x00,0 x00,0 x00,/ 0 x00,0 x6c,0 x6c,0 xfe,0 x6c,0 x6c,0 x6c,0 xfe,0 x6c,0 x6c,0 x00,0 x00,/ # 0 x30,0 x30,0 x7c,0 xc0,0 xc0,0 x78,0 x0c,0 x0c,0 xf8,0 x30,0 x30,0 x00,/ $ 0 x00,0 x00,0 x00,0 xc4,0 xcc,0 x18,0 x30,0 x60,0 xcc,0 x8c,0 x00,0 x00,/ % 0 x00,0 x70,0 xd8,0 xd8,0 x70,0 xfa,0 xde,0 xcc,0 xd

40、c,0 x76,0 x00,0 x00,/ & 0 x00,0 x30,0 x30,0 x30,0 x60,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,/ 0 x00,0 x0c,0 x18,0 x30,0 x60,0 x60,0 x60,0 x30,0 x18,0 x0c,0 x00,0 x00,/ ( 0 x00,0 x60,0 x30,0 x18,0 x0c,0 x0c,0 x0c,0 x18,0 x30,0 x60,0 x00,0 x00,/ ) 0 x00,0 x00,0 x00,0 x66,0 x3c,0 xff,0 x3c,0 x66,0

41、x00,0 x00,0 x00,0 x00,/ * 0 x00,0 x00,0 x00,0 x18,0 x18,0 x7e,0 x18,0 x18,0 x00,0 x00,0 x00,0 x00,/ + 0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x38,0 x38,0 x60,0 x00,/ , 0 x00,0 x00,0 x00,0 x00,0 x00,0 xfe,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,/ - 0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x0

42、0,0 x38,0 x38,0 x00,0 x00,/ . 0 x00,0 x00,0 x02,0 x06,0 x0c,0 x18,0 x30,0 x60,0 xc0,0 x80,0 x00,0 x00,/ / 0 x00,0 x7c,0 xc6,0 xce,0 xde,0 xd6,0 xf6,0 xe6,0 xc6,0 x7c,0 x00,0 x00,/ 0 0 x00,0 x10,0 x30,0 xf0,0 x30,0 x30,0 x30,0 x30,0 x30,0 xfc,0 x00,0 x00,/ 1 0 x00,0 x78,0 xcc,0 xcc,0 x0c,0 x18,0 x30,

43、0 x60,0 xcc,0 xfc,0 x00,0 x00,/ 2 0 x00,0 x78,0 xcc,0 x0c,0 x0c,0 x38,0 x0c,0 x0c,0 xcc,0 x78,0 x00,0 x00,/ 3 0 x00,0 x0c,0 x1c,0 x3c,0 x6c,0 xcc,0 xfe,0 x0c,0 x0c,0 x1e,0 x00,0 x00,/ 4 0 x00,0 xfc,0 xc0,0 xc0,0 xc0,0 xf8,0 x0c,0 x0c,0 xcc,0 x78,0 x00,0 x00,/ 5 0 x00,0 x38,0 x60,0 xc0,0 xc0,0 xf8,0

44、xcc,0 xcc,0 xcc,0 x78,0 x00,0 x00,/ 6 0 x00,0 xfe,0 xc6,0 xc6,0 x06,0 x0c,0 x18,0 x30,0 x30,0 x30,0 x00,0 x00,/ 7 0 x00,0 x78,0 xcc,0 xcc,0 xec,0 x78,0 xdc,0 xcc,0 xcc,0 x78,0 x00,0 x00,/ 8 0 x00,0 x78,0 xcc,0 xcc,0 xcc,0 x7c,0 x18,0 x18,0 x30,0 x70,0 x00,0 x00,/ 9 0 x00,0 x00,0 x00,0 x38,0 x38,0 x0

45、0,0 x00,0 x38,0 x38,0 x00,0 x00,0 x00,/ : 0 x00,0 x00,0 x00,0 x38,0 x38,0 x00,0 x00,0 x38,0 x38,0 x18,0 x30,0 x00,/ ; 0 x00,0 x0c,0 x18,0 x30,0 x60,0 xc0,0 x60,0 x30,0 x18,0 x0c,0 x00,0 x00,/ 0 x00,0 x78,0 xcc,0 x0c,0 x18,0 x30,0 x30,0 x00,0 x30,0 x30,0 x00,0 x00,/ ? 0 x00,0 x7c,0 xc6,0 xc6,0 xde,0

46、xde,0 xde,0 xc0,0 xc0,0 x7c,0 x00,0 x00,/ 0 x00,0 x30,0 x78,0 xcc,0 xcc,0 xcc,0 xfc,0 xcc,0 xcc,0 xcc,0 x00,0 x00,/ A 0 x00,0 xfc,0 x66,0 x66,0 x66,0 x7c,0 x66,0 x66,0 x66,0 xfc,0 x00,0 x00,/ B 0 x00,0 x3c,0 x66,0 xc6,0 xc0,0 xc0,0 xc0,0 xc6,0 x66,0 x3c,0 x00,0 x00,/ C 0 x00,0 xf8,0 x6c,0 x66,0 x66,

47、0 x66,0 x66,0 x66,0 x6c,0 xf8,0 x00,0 x00,/ D 0 x00,0 xfe,0 x62,0 x60,0 x64,0 x7c,0 x64,0 x60,0 x62,0 xfe,0 x00,0 x00,/ E 0 x00,0 xfe,0 x66,0 x62,0 x64,0 x7c,0 x64,0 x60,0 x60,0 xf0,0 x00,0 x00,/ F 0 x00,0 x3c,0 x66,0 xc6,0 xc0,0 xc0,0 xce,0 xc6,0 x66,0 x3e,0 x00,0 x00,/ G 0 x00,0 xcc,0 xcc,0 xcc,0

48、xcc,0 xfc,0 xcc,0 xcc,0 xcc,0 xcc,0 x00,0 x00,/ H 0 x00,0 x78,0 x30,0 x30,0 x30,0 x30,0 x30,0 x30,0 x30,0 x78,0 x00,0 x00,/ I 0 x00,0 x1e,0 x0c,0 x0c,0 x0c,0 x0c,0 xcc,0 xcc,0 xcc,0 x78,0 x00,0 x00,/ J 0 x00,0 xe6,0 x66,0 x6c,0 x6c,0 x78,0 x6c,0 x6c,0 x66,0 xe6,0 x00,0 x00,/ K 0 x00,0 xf0,0 x60,0 x6

49、0,0 x60,0 x60,0 x62,0 x66,0 x66,0 xfe,0 x00,0 x00,/ L 0 x00,0 xc6,0 xee,0 xfe,0 xfe,0 xd6,0 xc6,0 xc6,0 xc6,0 xc6,0 x00,0 x00,/ M 0 x00,0 xc6,0 xc6,0 xe6,0 xf6,0 xfe,0 xde,0 xce,0 xc6,0 xc6,0 x00,0 x00,/ N 0 x00,0 x38,0 x6c,0 xc6,0 xc6,0 xc6,0 xc6,0 xc6,0 x6c,0 x38,0 x00,0 x00,/ O 0 x00,0 xfc,0 x66,

50、0 x66,0 x66,0 x7c,0 x60,0 x60,0 x60,0 xf0,0 x00,0 x00,/ P 0 x00,0 x38,0 x6c,0 xc6,0 xc6,0 xc6,0 xce,0 xde,0 x7c,0 x0c,0 x1e,0 x00,/ Q 0 x00,0 xfc,0 x66,0 x66,0 x66,0 x7c,0 x6c,0 x66,0 x66,0 xe6,0 x00,0 x00,/ R 0 x00,0 x78,0 xcc,0 xcc,0 xc0,0 x70,0 x18,0 xcc,0 xcc,0 x78,0 x00,0 x00,/ S 0 x00,0 xfc,0

51、xb4,0 x30,0 x30,0 x30,0 x30,0 x30,0 x30,0 x78,0 x00,0 x00,/ T 0 x00,0 xcc,0 xcc,0 xcc,0 xcc,0 xcc,0 xcc,0 xcc,0 xcc,0 x78,0 x00,0 x00,/ U 0 x00,0 xcc,0 xcc,0 xcc,0 xcc,0 xcc,0 xcc,0 xcc,0 x78,0 x30,0 x00,0 x00,/ V 0 x00,0 xc6,0 xc6,0 xc6,0 xc6,0 xd6,0 xd6,0 x6c,0 x6c,0 x6c,0 x00,0 x00,/ W 0 x00,0 xc

52、c,0 xcc,0 xcc,0 x78,0 x30,0 x78,0 xcc,0 xcc,0 xcc,0 x00,0 x00,/ X 0 x00,0 xcc,0 xcc,0 xcc,0 xcc,0 x78,0 x30,0 x30,0 x30,0 x78,0 x00,0 x00,/ Y 0 x00,0 xfe,0 xce,0 x98,0 x18,0 x30,0 x60,0 x62,0 xc6,0 xfe,0 x00,0 x00,/ Z 0 x00,0 x3c,0 x30,0 x30,0 x30,0 x30,0 x30,0 x30,0 x30,0 x3c,0 x00,0 x00,/ 0 x00,0

53、x00,0 x80,0 xc0,0 x60,0 x30,0 x18,0 x0c,0 x06,0 x02,0 x00,0 x00,/ 0 x00,0 x3c,0 x0c,0 x0c,0 x0c,0 x0c,0 x0c,0 x0c,0 x0c,0 x3c,0 x00,0 x00,/ 0 x10,0 x38,0 x6c,0 xc6,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,/ 0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 xff,0 x00,/ _ 0 x30,0 x3

54、0,0 x18,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,/ 0 x00,0 x00,0 x00,0 x00,0 x78,0 x0c,0 x7c,0 xcc,0 xcc,0 x76,0 x00,0 x00,/ a 0 x00,0 xe0,0 x60,0 x60,0 x7c,0 x66,0 x66,0 x66,0 x66,0 xdc,0 x00,0 x00,/ b 0 x00,0 x00,0 x00,0 x00,0 x78,0 xcc,0 xc0,0 xc0,0 xcc,0 x78,0 x00,0 x00,/ c 0 x00,0

55、x1c,0 x0c,0 x0c,0 x7c,0 xcc,0 xcc,0 xcc,0 xcc,0 x76,0 x00,0 x00,/ d 0 x00,0 x00,0 x00,0 x00,0 x78,0 xcc,0 xfc,0 xc0,0 xcc,0 x78,0 x00,0 x00,/ e 0 x00,0 x38,0 x6c,0 x60,0 x60,0 xf8,0 x60,0 x60,0 x60,0 xf0,0 x00,0 x00,/ f 0 x00,0 x00,0 x00,0 x00,0 x76,0 xcc,0 xcc,0 xcc,0 x7c,0 x0c,0 xcc,0 x78,/ g 0 x0

56、0,0 xe0,0 x60,0 x60,0 x6c,0 x76,0 x66,0 x66,0 x66,0 xe6,0 x00,0 x00,/ h 0 x00,0 x18,0 x18,0 x00,0 x78,0 x18,0 x18,0 x18,0 x18,0 x7e,0 x00,0 x00,/ i 0 x00,0 x0c,0 x0c,0 x00,0 x3c,0 x0c,0 x0c,0 x0c,0 x0c,0 xcc,0 xcc,0 x78,/ j 0 x00,0 xe0,0 x60,0 x60,0 x66,0 x6c,0 x78,0 x6c,0 x66,0 xe6,0 x00,0 x00,/ k

57、0 x00,0 x78,0 x18,0 x18,0 x18,0 x18,0 x18,0 x18,0 x18,0 x7e,0 x00,0 x00,/ l 0 x00,0 x00,0 x00,0 x00,0 xfc,0 xd6,0 xd6,0 xd6,0 xd6,0 xc6,0 x00,0 x00,/ m 0 x00,0 x00,0 x00,0 x00,0 xf8,0 xcc,0 xcc,0 xcc,0 xcc,0 xcc,0 x00,0 x00,/ n 0 x00,0 x00,0 x00,0 x00,0 x78,0 xcc,0 xcc,0 xcc,0 xcc,0 x78,0 x00,0 x00,

58、/ o 0 x00,0 x00,0 x00,0 x00,0 xdc,0 x66,0 x66,0 x66,0 x66,0 x7c,0 x60,0 xf0,/ p 0 x00,0 x00,0 x00,0 x00,0 x76,0 xcc,0 xcc,0 xcc,0 xcc,0 x7c,0 x0c,0 x1e,/ q 0 x00,0 x00,0 x00,0 x00,0 xec,0 x6e,0 x76,0 x60,0 x60,0 xf0,0 x00,0 x00,/ r 0 x00,0 x00,0 x00,0 x00,0 x78,0 xcc,0 x60,0 x18,0 xcc,0 x78,0 x00,0

59、x00,/ s 0 x00,0 x00,0 x20,0 x60,0 xfc,0 x60,0 x60,0 x60,0 x6c,0 x38,0 x00,0 x00,/ t 0 x00,0 x00,0 x00,0 x00,0 xcc,0 xcc,0 xcc,0 xcc,0 xcc,0 x76,0 x00,0 x00,/ u 0 x00,0 x00,0 x00,0 x00,0 xcc,0 xcc,0 xcc,0 xcc,0 x78,0 x30,0 x00,0 x00,/ v 0 x00,0 x00,0 x00,0 x00,0 xc6,0 xc6,0 xd6,0 xd6,0 x6c,0 x6c,0 x0

60、0,0 x00,/ w 0 x00,0 x00,0 x00,0 x00,0 xc6,0 x6c,0 x38,0 x38,0 x6c,0 xc6,0 x00,0 x00,/ x 0 x00,0 x00,0 x00,0 x00,0 x66,0 x66,0 x66,0 x66,0 x3c,0 x0c,0 x18,0 xf0,/ y 0 x00,0 x00,0 x00,0 x00,0 xfc,0 x8c,0 x18,0 x60,0 xc4,0 xfc,0 x00,0 x00,/ z0 x00,0 x1c,0 x30,0 x30,0 x60,0 xc0,0 x60,0 x30,0 x30,0 x1c,0

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 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ì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論