【正文】
POS(0x09)。 Set_LCD_POS(0x45)。 Set_LCD_POS(0x4d)。 T_12_miao。 KeyPressDown=1。 //定時 50ms if(++tCount_T0!=20) return。 Set_LCD_POS(0x4c)。 Set_LCD_POS(0x44)。 Set_LCD_POS(0x08)。 while(1) { if(KeyPressDown==1) { KeyPressDown=0。 Initialize_LCD()。 case 6:jie++。break。//燈亮標志 uchar Flag_finish=0。 在論文即將完成之際,我的心情無法平靜,從開始進入課題到論文的順利完成,有多少可敬的師長、同學、朋友給了我無言的幫助,在這里請接受我誠摯的謝意 ! 最后我還要感謝培養(yǎng)我長大含辛茹苦的父母,謝謝 你們! 安徽財經(jīng)大學管理科學與工程學院本科畢業(yè)設計 27 附錄 主 程序: include include define uchar unsigned char define uint unsigned int sbit led=P2^4。對單片機設置完畢后就可以開始仿真了。作為可編程器件,單片機中的定時 /計數(shù)器初始化編程步驟如下: 根據(jù)定時時間要求或計數(shù)要求計算計數(shù)器初值: 將工作方式控制字寫入 TMOD 寄存器; 將計數(shù)初值寫入 THX 和 TLX 寄存器; 啟動定時器 /計數(shù)器,即將 TRX置位。 安徽財經(jīng)大學管理科學與工程學院本科畢業(yè)設計 15 圖 LCD1602液晶顯示 LED 發(fā)光二極管顯示電路如下 ,正極接 P2^4,負極接地,當 P2^4 為低電平時,發(fā)光二極管不亮,當 P2^4 為高電平時,發(fā)光二極管亮。例如 “A” 01110 ○■■■○ 10001 ■○○○■ 10001 ■○○○■ 10001 ■○○○■ 11111 ■■■■■ 10001 ■○○○■ 10001 ■○○○■ 圖 33 39。液晶成本較高,面積無法做得很大,但圖像質(zhì)量很好,適合做顯示器。推出掉電模式的唯一方法是硬件復位。 此外, AT89C51 設有穩(wěn)態(tài)邏輯,可以在低到零頻率的條件下靜態(tài)邏輯,支持兩種軟件可選的掉電模式。因此它可用作對外部輸出的脈沖或用于定時目的。在 FLASH編程和校驗時, P1 口作為第八位地址 接收。 INTEL 公司將 MCS51 的核心技術(shù)授權(quán)給了很多其它公司,所以有很多公司在做以 8051 為核心的單片機,當然,功能或多或少有些改變,以滿足不同的需求,其中 89C51 就是這幾年在我國非常流行的單片機,它是由美國 ATMEL 公司開發(fā)生產(chǎn)的。此裝置利用單片機 AT89C51 完成了計時和計分的功能。 關鍵詞 : AT89C51;矩陣鍵盤; LCD1602; 計數(shù)器;計時器 Abstract This design project using AT89C51 microcontroller as the core, design basketball scoring timing system, countdown to a single game of 12 minutes, 24 seconds shot clock countdown, start / pause and change the section, a single end alarm, the teams were, respectively, add 1 point, 2 points, plus 3 grading a variety of display. This system uses the LCD1602 LCD monitor as a display, Display Session, 12 minutes 24 seconds of the countdown, countdown to the main visiting team score by 3 * 3 matrix keyboard to control the timer and counter, LED blinks when a single end of the game alarm. The design uses LCD1602 LCD display to get more and more widely in the pocketsized instrument and lowpower applications because of its micropower, small size, the use of flexible and many other advantages through simulation basically realize the above functions, the operation simple, stable performance, in line with the general basketball scoring requirements. Key word: AT89C51; Matrix Keyboard; LCD1602; Counter; Timer目 錄 1 引言 ........................................................................................................................... 1 本課題選取的目的及意義 ............................................................................ 1 本系統(tǒng)的主要研究內(nèi)容 ................................................................................ 2 2 系統(tǒng)分析 ................................................................................................................. 3 系統(tǒng)構(gòu)成 ........................................................................................................ 3 系統(tǒng)工作原理 ................................................................................................ 3 3 系統(tǒng)硬件設計 ........................................................................................................ 4 系統(tǒng)硬件總體設計 ........................................................................................ 4 AT89C51 單片機 ........................................................................................... 5 AT89C51簡介 .......................................................................................... 5 主要特性 ................................................................................................. 6 管腳說明 ................................................................................................. 7 芯片擦出 ................................................................................................. 9 空閑節(jié)電模式 .......................................................................................... 9 掉電模式 ............................................................................................... 10 程序儲存器的加密 ..................................................................................11 AT89C51的極限參數(shù) ..............................................................................11 LCD1602 液晶顯示模塊 ..............................................................................11 顯示器介紹 .........................................................................................11 3*3 矩陣鍵盤模塊 ....................................................................................... 15 時鐘電路模塊 .............................................................................................. 16 復位電路模塊 .............................................................................................. 17 元件清單 ...................................................................................................... 17 4 系統(tǒng)軟件設計 ................................................