欧洲免费无码视频在线,亚洲日韩av中文字幕高清一区二区,亚洲人成人77777网站,韩国特黄毛片一级毛片免费,精品国产欧美,成人午夜精选视频在线观看免费,五月情天丁香宗合成人网

薈聚奇文、博采眾長、見賢思齊
當(dāng)前位置:公文素材庫 > 計(jì)劃總結(jié) > 工作總結(jié) > 單片機(jī)實(shí)訓(xùn)總結(jié)

單片機(jī)實(shí)訓(xùn)總結(jié)

網(wǎng)站:公文素材庫 | 時(shí)間:2019-05-28 03:19:01 | 移動端:單片機(jī)實(shí)訓(xùn)總結(jié)

單片機(jī)實(shí)訓(xùn)總結(jié)

學(xué)生實(shí)訓(xùn)總結(jié)報(bào)告專業(yè):應(yīng)用電子技術(shù)班級:學(xué)號:姓名:實(shí)訓(xùn)室:日期:至止指導(dǎo)教師:

201*年12月日

學(xué)生實(shí)訓(xùn)總結(jié)報(bào)告

說明

1.

實(shí)訓(xùn)結(jié)束之前,每個(gè)學(xué)生都必須認(rèn)真撰寫《實(shí)訓(xùn)總結(jié)報(bào)告》。通過撰寫實(shí)訓(xùn)總結(jié)報(bào)告,系統(tǒng)地回顧和總結(jié)實(shí)訓(xùn)的全過程,將實(shí)踐性教學(xué)的感性認(rèn)識升華到一定的理論高度,從而提高實(shí)訓(xùn)教學(xué)效果。

實(shí)訓(xùn)總結(jié)報(bào)告要求條理清晰,內(nèi)容詳盡,數(shù)據(jù)準(zhǔn)確。字?jǐn)?shù)不少于201*字。

實(shí)訓(xùn)總結(jié)報(bào)告的質(zhì)量反映了實(shí)訓(xùn)的質(zhì)量,它是實(shí)訓(xùn)成績評定的主要依據(jù)之一。應(yīng)在實(shí)訓(xùn)結(jié)束后兩周內(nèi)將此報(bào)告上交學(xué)院教學(xué)辦公室。不交實(shí)訓(xùn)報(bào)告者不得參加實(shí)訓(xùn)成績評定。

封面中的“實(shí)訓(xùn)室”必須寫全名,必須寫上指導(dǎo)教師姓名。

“前言”部分:“實(shí)訓(xùn)背景”可簡介實(shí)訓(xùn)目的、通過何種方式到此單位實(shí)訓(xùn)等內(nèi)容;“實(shí)訓(xùn)環(huán)境”可包括實(shí)訓(xùn)室全稱(中英文)、地址、規(guī)模、簡介等內(nèi)容!皩(shí)訓(xùn)內(nèi)容”部分:屬報(bào)告的主要部分!皩(shí)訓(xùn)過程”概述實(shí)訓(xùn)各階段所從事的主要工作等;“實(shí)訓(xùn)內(nèi)容”包括項(xiàng)目介紹、本人從事的工作、軟硬件平臺和技術(shù)等;“實(shí)訓(xùn)成果”應(yīng)具體列出自己所完成的主要成果及實(shí)際應(yīng)用情況等。

“總結(jié)”部分:其中“其它意見”可對學(xué)院課程設(shè)置、教學(xué)內(nèi)容、實(shí)訓(xùn)安排等方面提出自己的意見或建議,也可對實(shí)訓(xùn)單位的各個(gè)方面提出自己的意見。

2.3.

4.5.6.

7.

第2頁共6頁學(xué)生實(shí)訓(xùn)總結(jié)報(bào)告

目錄

1

1.11.2

前言.................................................4

實(shí)訓(xùn)背景...........................................................................................................4實(shí)訓(xùn)環(huán)境...........................................................................................................4

2

2.12.22.3

實(shí)訓(xùn)內(nèi)容.............................................5

實(shí)訓(xùn)過程...........................................................................................................5實(shí)訓(xùn)內(nèi)容...........................................................................................................5主要成果...........................................................................................................5

3

3.13.2

總結(jié).................................................6

實(shí)訓(xùn)體會...........................................................................................................6其它意見...........................................................................................................6

第3頁共6頁學(xué)生實(shí)訓(xùn)總結(jié)報(bào)告

1前言

1.1實(shí)訓(xùn)背景

通過實(shí)訓(xùn),掌握單片機(jī)內(nèi)部硬件結(jié)構(gòu)、工作原理,掌握程序的設(shè)計(jì)基本方法;掌握單片機(jī)的接口技術(shù),熟悉常用的外圍接口芯片及典型電路。熟悉設(shè)計(jì)、調(diào)試單片機(jī)的應(yīng)用系統(tǒng)的一般方法,具有初步的軟、硬件設(shè)計(jì)能力。1.2

實(shí)訓(xùn)環(huán)境

利用keiluVision軟件寫程序,并用stc-isp下載軟件中下載到鐵牛單片機(jī)中,上電運(yùn)行和檢查。

第4頁共6頁學(xué)生實(shí)訓(xùn)總結(jié)報(bào)告

2實(shí)訓(xùn)內(nèi)容

2.1實(shí)訓(xùn)過程

1)先將單片機(jī)上電,用USB接口的數(shù)據(jù)線將這塊單片機(jī)板與PC機(jī)連接;2)裝單片機(jī)驅(qū)動,對“我的電腦”右鍵,選擇“屬性”,在“設(shè)備管理器”里

的“端口”處識別該單片機(jī)的接口,如:(COM5);3)識別完后運(yùn)行spc-isp,選擇端口類型(COM5),然后將流水燈、蜂鳴器、繼電

器、數(shù)碼管靜態(tài)顯示、矩陣鍵盤等程序下載到單片機(jī)里,下載一個(gè)檢測一個(gè),看這塊單片機(jī)是否有哪里故障;

4)逐個(gè)檢測無故障后,在運(yùn)行keiluVision2編寫程序,便寫完后檢測看有沒有

錯(cuò)誤,確認(rèn)無誤后將這個(gè)程序下載到單片機(jī)上,得出最后的結(jié)果,即在數(shù)碼顯示管上顯示從0-9這些數(shù)字。

2.2

實(shí)訓(xùn)內(nèi)容

1)將流水燈、蜂鳴器、繼電器、數(shù)碼管靜態(tài)顯示、矩陣鍵盤的程序下載到單片機(jī)并觀察單

片機(jī)的顯示方式;

2)利用proteus畫圖,利用Reli編寫C語言程序,使用單片機(jī)的25個(gè)IO口,連接

發(fā)光管,組成5X5的矩陣顯示屏,在屏幕上顯示0到7這八個(gè)數(shù)字.

2.3

主要成果

完成對矩陣鍵盤電路、串口通信電路、數(shù)碼管顯示電路、蜂鳴器電路、繼電器電路等程序在單片機(jī)的運(yùn)行。

第5頁共6頁學(xué)生實(shí)訓(xùn)總結(jié)報(bào)告

3總結(jié)

3.1實(shí)訓(xùn)體會

通過這一周的實(shí)訓(xùn),對單片機(jī)加深了了解。對編寫程序有一定進(jìn)步,在理解單片機(jī)端口功能的前提下,才能寫出正確的程序。在實(shí)訓(xùn)的期間是很有趣的,當(dāng)出現(xiàn)一個(gè)很難攻破的程序時(shí),就覺得很想去挑戰(zhàn)它。當(dāng)找到一點(diǎn)突破口時(shí),自己從心底感覺到喜悅,當(dāng)成果出來時(shí),很有成就感。

對于這為期一周的實(shí)訓(xùn),是很快樂的。對單片機(jī)的興趣越發(fā)的濃厚,希望下次還有機(jī)會參加這樣的實(shí)訓(xùn),實(shí)訓(xùn)的時(shí)間能更長點(diǎn)。

3.2

其它意見

1)合理的安排時(shí)間。2)課題的難易程度。

第6頁共6頁

擴(kuò)展閱讀:單片機(jī)實(shí)習(xí)總結(jié)

專業(yè)綜合實(shí)習(xí)總結(jié)

201*-201*(2)

專業(yè)班級:電子信息工程0802學(xué)生學(xué)號:0414080224學(xué)生姓名:

指導(dǎo)教師:張?jiān)啤L春、馬崇霄、杜殿會實(shí)習(xí)時(shí)間:201*.6.20201*.7.15

機(jī)電工程學(xué)院

一、實(shí)習(xí)目的和意義

1、實(shí)習(xí)目的:

(1)利用單片機(jī)小系統(tǒng)實(shí)習(xí)板,掌握電路原理圖;

(2)通過對系統(tǒng)板的測試,了解系統(tǒng)板的工作原理及性能,掌握元器件及系統(tǒng)故障的排除方法;

(3)掌握程序編制及調(diào)試方法,完成系統(tǒng)初始化、存儲器操作、端口操作、模擬量采集、模擬量輸出、串口通訊、IIC、日歷時(shí)鐘芯片、鍵盤顯示等程序的編制及調(diào)試。

(4)通過單片機(jī)系統(tǒng)的調(diào)試、程序編制及運(yùn)行,掌握單片機(jī)系統(tǒng)的工作原理、開發(fā)方法和操作方法。2、實(shí)習(xí)意義:

電子技術(shù)和微型計(jì)算機(jī)的迅速發(fā)展,促進(jìn)了微型計(jì)算機(jī)測量和控制技術(shù)的迅速發(fā)展和廣泛應(yīng)用。微機(jī)測控技術(shù)的應(yīng)用已滲透到國民經(jīng)濟(jì)的各個(gè)部門。可以說,微機(jī)測控技術(shù)的應(yīng)用是產(chǎn)品提高檔次和推陳出新的有效途徑。創(chuàng)新精神和實(shí)踐能力是對新時(shí)期高素質(zhì)人才的基本要求。通過本實(shí)習(xí)不但可以掌握單片機(jī)軟、硬件的綜合調(diào)試方法,而且可以熟練掌握電路原理圖,激發(fā)對單片機(jī)智能性的探索精神,提高學(xué)生的綜合素質(zhì),培養(yǎng)學(xué)生應(yīng)用單片機(jī)實(shí)現(xiàn)對工業(yè)控制系統(tǒng)的設(shè)計(jì)、開發(fā)與調(diào)試的能力。在制作學(xué)習(xí)過程中,不但可以掌握軟、硬件的綜合調(diào)試方法,而且可以使學(xué)生對單片機(jī)智能性產(chǎn)生強(qiáng)烈的欲望。達(dá)到最大限度地掌握微機(jī)應(yīng)用技術(shù),軟件及接口設(shè)計(jì)和數(shù)據(jù)采集與處理的技能,培養(yǎng)電綜合實(shí)踐素質(zhì)的目。

二、實(shí)習(xí)內(nèi)容

1.熟悉“單片機(jī)課程實(shí)習(xí)”電路板,領(lǐng)會、掌握該電路板的設(shè)計(jì)原理及硬件布局。2.掌握單片機(jī)技術(shù)應(yīng)用平臺keil軟件的學(xué)習(xí)。

3.借助平臺軟件,學(xué)習(xí)開發(fā)板的使用,按照要求編制、調(diào)試出正確的匯編語言程序。4.學(xué)習(xí)適合本開發(fā)平臺軟件STC-ISP的在線單片機(jī)燒錄。

5.針對實(shí)習(xí)電路板的功能,編制、調(diào)試、編譯匯編語言程序,下載燒錄并在實(shí)驗(yàn)板上運(yùn)行,或利用軟件proteus進(jìn)行軟件仿真。

實(shí)現(xiàn)的功能:

1.led顯示模塊:單向循環(huán)流水led顯示、雙向循環(huán)流水led顯示、花樣流水燈的顯示,使用查表方法編制任意點(diǎn)亮歷程的實(shí)現(xiàn),使用軟件延時(shí);

2.數(shù)碼管顯示模塊:一位靜態(tài)數(shù)碼管顯示0到9和0到F、二位靜態(tài)數(shù)碼管顯示0到99、三位靜態(tài)數(shù)碼管顯示0到999、四位靜態(tài)數(shù)碼管顯示0到9999;陰極和陽極四位動態(tài)數(shù)碼管顯示;74LS驅(qū)動4位靜態(tài)數(shù)碼管顯示;利用74HC595四位靜態(tài)數(shù)碼管顯示;使用串行靜態(tài)顯示和動態(tài)掃描顯示兩種方式;

3.鍵盤模塊:利用4×4矩陣鍵盤按鍵對應(yīng)置數(shù)顯示“0~F”;使用鍵盤的行列掃描方式;

三、硬件介紹

(一)LED顯示模塊:

C21930pFU1XTAL1X1CRYSTALC118XTAL29RSTP0.0/AD0P0.1/AD1P0.2/AD2P0.3/AD3P0.4/AD4P0.5/AD5P0.6/AD6P0.7/AD7P2.0/A8P2.1/A9P2.2/A10P2.3/A11P2.4/A12P2.5/A13P2.6/A14P2.7/A15P3.0/RXDP3.1/TXDP3.2/INT0P3.3/INT1P3.4/T0P3.5/T1P3.6/WRP3.7/RD393837363534333221222324252627281011121314151617R11kC31uF29303130pF12345678PSENALEEAR251kP1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7AT89C51D7LED-REDD6LED-REDD5LED-REDD4LED-REDD3LED-REDD2LED-REDD1LED-REDD0LED-RED圖1流水燈顯示

C130pX1CRYSTALVCCC230pU119XTAL1P0.0/AD0P0.1/AD1P0.2/AD2P0.3/AD3P0.4/AD4P0.5/AD5P0.6/AD6P0.7/AD7P2.0/A8P2.1/A9P2.2/A10P2.3/A11P2.4/A12P2.5/A13P2.6/A14P2.7/A15P3.0/RXDP3.1/TXDP3.2/INT0P3.3/INT1P3.4/T0P3.5/T1P3.6/WRP3.7/RD393837363534333221222324252627281011121314151617D1D2D3D4D5D6D7D8LED-REDR3R4200R5201*8XTAL2C31uF9LED-GREENRSTR21kLED-REDLED-REDR6201*00R151k293031PSENALEEAR7R8200LED-RED12345678P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7AT89C51LED-REDR9R10200LED-REDLED-RED200圖2鍵盤控制循環(huán)燈(二)數(shù)碼管顯示模塊:

R10R4R3R5R6R7R8R910k10k10k10k10k10k10k10kC21930pFU1XTAL1X1CRYSTALC118XTAL29RSTP0.0/AD0P0.1/AD1P0.2/AD2P0.3/AD3P0.4/AD4P0.5/AD5P0.6/AD6P0.7/AD7P2.0/A8P2.1/A9P2.2/A10P2.3/A11P2.4/A12P2.5/A13P2.6/A14P2.7/A15P3.0/RXDP3.1/TXDP3.2/INT0P3.3/INT1P3.4/T0P3.5/T1P3.6/WRP3.7/RD393837363534333221222324252627281011121314151617R11kC31uF29303130pF12345678PSENALEEAR251kP1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7AT89C51圖31位靜態(tài)數(shù)碼管顯示

VCCVCCC21930pFR10R4R3R5R6R7R8R9R14R13R12R11R15R16R18R17R22R21R20R19R23R24R26R25R34R33R32R27R28R29R30R31U1XTAL110k10k10k10k10k10k10k10kP0.0/AD0P0.1/AD1P0.2/AD2P0.3/AD3P0.4/AD4P0.5/AD5P0.6/AD6P0.7/AD7P2.0/A8P2.1/A9P2.2/A10P2.3/A11P2.4/A12P2.5/A13P2.6/A14P2.7/A15P3.0/RXDP3.1/TXDP3.2/INT0P3.3/INT1P3.4/T0P3.5/T1P3.6/WRP3.7/RD39383736353433322122232425262728101112131415161710k10k10k10k10k10k10k10k10k10k10k10k10k10k10k10k10k10k10k10k10k10k10k10kX1CRYSTAL18XTAL29RSTR11kC31uF293031PSENALEEAR251k12345678P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7AT89C51圖44位靜態(tài)數(shù)碼管顯示P0.0P0.1P0.2P0.3P0.4P0.5P0.6P0.7P2.3P2.2P2.1P2.0VCCC1U130PF191P0.0/AD0P0.1/AD1P0.2/AD2P0.3/AD3P0.4/AD4P0.5/AD5P0.6/AD6P0.7/AD7P2.0/A8P2.1/A9P2.2/A10P2.3/A11P2.4/A12P2.5/A13P2.6/A14P2.7/A15P3.0/RXDP3.1/TXDP3.2/INT0P3.3/INT1P3.4/T0P3.5/T1P3.6/WRP3.7/RD393837363534333221222324252627281011121314151617P0.0P0.1P0.2P0.3P0.4P0.5P0.6P0.7P2.0P2.1P2.2P2.3P2.4P2.5P2.6P2.7RXDTXDINT0INT1T0T1WRRDP0.0P0.1P0.2P0.3P0.4P0.5P0.6P0.723456789XTAL1RP1X1CRYSTAL18C230PFXTAL2C3910uRSTVCCRESPACK-8R110kVCC293031PSENALEEAP1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.712345678P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7AT89C51圖54位動態(tài)數(shù)碼管顯示VCCRP1U119XTAL1P0.0/AD0P0.1/AD1P0.2/AD2P0.3/AD3P0.4/AD4P0.5/AD5P0.6/AD6P0.7/AD7P2.0/A8P2.1/A9P2.2/A10P2.3/A11P2.4/A12P2.5/A13P2.6/A14P2.7/A15P3.0/RXDP3.1/TXDP3.2/INT0P3.3/INT1P3.4/T0P3.5/T1P3.6/WRP3.7/RD393837363534333221222324252627281011121314151617D0D1D2D3D4D5D6D7123456789RESPACK-8D0D1D2D3D4D5D6D7WE1WE2WE3WE4WE5WE6abcdefghU223456789D0D1D2D3D4D5D6D7LEOE74HC573Q0Q1Q2Q3Q4Q5Q6Q71918171615141312abcdefgh18XTAL2DULA1119RSTU3D0D1D2D3D4D5D6D723456789D0D1D2D3D4D5D6D7LEOE74HC573WRQ0Q1Q2Q3Q4Q5Q6Q71918171615141312WE1WE2WE3WE4WE5WE6293031PSENALEEADULAWELA12345678P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.780C51T0T0T1WRRDT1WELA111RD圖6獨(dú)立鍵盤加減清零數(shù)碼管顯示U274LS164U374LS16413121110131211101312111013121110654365436543654U41DSRG81D74LS1643U574L1DSRG81DSRG8C1/->C1/->C1/->RRRC1/->8&&&&21821821899921RXDC1U130PF19XTAL1P0.0/AD0P0.1/AD1P0.2/AD2P0.3/AD3P0.4/AD4P0.5/AD5P0.6/AD6P0.7/AD7P2.0/A8P2.1/A9P2.2/A10P2.3/A11P2.4/A12P2.5/A13P2.6/A14P2.7/A15P3.0/RXDP3.1/TXDP3.2/INT0P3.3/INT1P3.4/T0P3.5/T1P3.6/WRP3.7/RD393837363534333221222324252627281011121314151617P0.0P0.1P0.2P0.3P0.4P0.5P0.6P0.7P2.0P2.1P2.2P2.3P2.4P2.5P2.6P2.7RXDTXDINT0INT1T0T1WRRDTXDVCCRP11P0.0P0.1P0.2P0.3P0.4P0.5P0.6P0.723456789RESPACK-8X1CRYSTALC230PF18XTAL2C39RSTVCCR110k10uVCC293031PSENALEEAP1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.712345678P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.780C519RVCCSRG8圖74位74LS驅(qū)動靜態(tài)數(shù)碼管顯示

161514131211109161514131211109161514131211109RN110kRN210kRN310k161514131211109RN410k123456781234567812345678976543211597654321159765432115Q7Q7Q6Q5Q4Q3Q2Q1Q0Q7Q7Q6Q5Q4Q3Q2Q1Q0Q7Q7Q6Q5Q4Q3Q2Q1Q074HC59574HC59574HC595Q7Q7Q6Q5Q4Q3Q2Q1Q0131012U2U3U4976543211512345678U574HC595DSSH_CPDSSH_CPDSSH_CP131012141113101214111310121411P1.0RXDTXDC130pFX1CRYSTALU119XTAL1P0.0/AD0P0.1/AD1P0.2/AD2P0.3/AD3P0.4/AD4P0.5/AD5P0.6/AD6P0.7/AD7P2.0/A8P2.1/A9P2.2/A10P2.3/A11P2.4/A12P2.5/A13P2.6/A14P2.7/A15P3.0/RXDP3.1/TXDP3.2/INT0P3.3/INT1P3.4/T0P3.5/T1P3.6/WRP3.7/RD39P0.038P0.137P0.236P0.335P0.434P0.533P0.632P0.721222324252627281011121314151617P2.0P2.1P2.2P2.3P2.4P2.5P2.6P2.7RXDTXDINT0INT1T0T1WRRDC2C330pF10u18XTAL2RP11P0.02P0.13P0.24P0.35P0.46P0.57P0.68P0.79RESPACK-89RSTR110k293031PSENALEEAP1.01P1.12P1.23P1.34P1.45P1.56P1.67P1.78P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7AT89C511411DSSH_CPST_CPST_CPST_CPST_CPOEMROEMROEMROEMR圖84位74HC595靜態(tài)顯示(三)鍵盤顯示模塊:

C1191nFCRYSTALU1XTAL1X1C2GNDVCC18XTAL21nFC39100uR110kVCCRSTP0.0/AD0P0.1/AD1P0.2/AD2P0.3/AD3P0.4/AD4P0.5/AD5P0.6/AD6P0.7/AD7P2.0/A8P2.1/A9P2.2/A10P2.3/A11P2.4/A12P2.5/A13P2.6/A14P2.7/A15P3.0/RXDP3.1/TXDP3.2/INT0P3.3/INT1P3.4/T0P3.5/T1P3.6/WRP3.7/RD393837363534333221222324252627281011121314151617P0.0P0.1P0.2P0.3P0.4P0.5P0.6P0.7P2.0P2.1P2.2P2.3P2.4P2.5P2.6P2.7RXDTXDINT0INT1T0T1WRRDGND293031PSENALEEAVCCP1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.712345678P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7AT89C51R3R4R5R6R7R8R9R1010k10k10k10k10k10k10k10kP0.0P0.1P0.2P0.3P0.4P0.5P0.6P0.7P1.0VCCRP11P1.1P0.02P0.13P0.24P0.35P0.46P0.57P0.68P0.79RESPACK-8P1.2P1.3P1.7P1.6P1.5P1.4圖90到F矩陣鍵盤

四、軟件程序流程圖

流水燈循環(huán)左移右移程序框圖:開始運(yùn)行主程序給P1口賦初值80HA循環(huán)左移,并在P1口輸出否調(diào)用延時(shí)程序判別A與80H是否相等是A循環(huán)右移,并在P1口輸出否調(diào)用延時(shí)程序判別A與01H是否相等結(jié)束

是1、

、0到F一位靜態(tài)顯示程序框圖:開始1.建0F的字形碼表2.用累加器A控制P0口并傳遞參數(shù)3.R0記錄目前顯示的字型碼R0=0A=R0查字型碼表,顯示0延時(shí)INCR0是R0=16?否繼續(xù)查表,顯示下一個(gè)字型延時(shí)

3、0到9一位靜態(tài)顯示程序框圖:

開始(P0)=0A=P0查字型碼表,取得段驅(qū)動碼段驅(qū)動碼送P0口延時(shí)(R0)+1NR0=10?YR0=02

4、動態(tài)數(shù)碼顯示程序框圖:

開始P0口,P2口初始化置相應(yīng)的使能位查表顯示延時(shí)N顯示完Y置使能位處值返回

5、4×4矩陣矩陣鍵盤數(shù)碼顯示程序框圖:主程序圖:

開始掃描N是否有鍵按下YY識別是哪一個(gè)鍵按下通過P0口查詢顯示該序號

判別是否有鍵按下程序:

開始P1=FFH,P1.2=0P1=FFH,P1.0=0有鍵按下嗎?有鍵按下嗎?延時(shí)去抖動延時(shí)10ms真的有鍵按下?真的有鍵按下?根據(jù)當(dāng)前狀態(tài)識別按鍵根據(jù)當(dāng)前狀態(tài)識別按鍵P1=FFH,P1.1=0P1=FFH,P1.3=0有鍵按下嗎?有鍵按下嗎?延時(shí)10ms延時(shí)10ms真的有鍵按下嗎?真的有鍵按下嗎?根據(jù)當(dāng)前狀態(tài)識別按鍵根據(jù)當(dāng)前狀態(tài)識別按鍵

五、實(shí)習(xí)的心得體會

本次單片機(jī)實(shí)習(xí)我們一共完成了三個(gè)模塊的程序設(shè)計(jì),包括:led顯示模塊、數(shù)碼管顯示模塊和鍵盤模塊。分別實(shí)現(xiàn)了流水燈的循環(huán)點(diǎn)亮控制、數(shù)碼管的靜態(tài)和動態(tài)計(jì)數(shù)顯示,還有矩陣鍵盤按鍵控制數(shù)碼管顯示的程序設(shè)計(jì)。然后我們分別用protues系統(tǒng)仿真軟件對各個(gè)模塊進(jìn)行了模擬仿真,用keil軟件編制了匯編語言程序,驗(yàn)證了我們所設(shè)計(jì)的程序。

這次實(shí)習(xí)還使我理解了編寫程序的一些技巧。單片機(jī)應(yīng)用系統(tǒng)一般由包含多個(gè)模塊的主程序和由各種子程序組成。每一模塊都要完成一個(gè)明確的任務(wù),實(shí)現(xiàn)某個(gè)具體的功能,如計(jì)算、接受、發(fā)送、延時(shí)、顯示等。采用模塊化程序設(shè)計(jì)方法,就是將這些具體功能程序進(jìn)行獨(dú)立設(shè)計(jì)和分別調(diào)試,最后將這些模塊程序裝配成整體程序并進(jìn)行聯(lián)合調(diào)試。模塊化程序設(shè)計(jì)方法的優(yōu)點(diǎn):一個(gè)模塊可以為多個(gè)程序所共享;單個(gè)功能明確的程序模塊的設(shè)計(jì)和調(diào)試比較方便,容易完成;利用已經(jīng)編好的成熟模塊,將大大縮短開發(fā)程序的時(shí)間,降低開發(fā)成本。采用循環(huán)結(jié)構(gòu)和子程序結(jié)構(gòu)可以使程序的容量大大減少,提高程序的效率,節(jié)省內(nèi)存。對于多重循環(huán),要注意各重循環(huán)的初值和循環(huán)結(jié)束的條件,避免出現(xiàn)程序無休止循環(huán)的“死循環(huán)”現(xiàn)象;

通過這次的實(shí)習(xí)我發(fā)現(xiàn),只有理論水平提高了,才能夠?qū)⒄n本知識與實(shí)踐相結(jié)合,理論知識服務(wù)于教學(xué)實(shí)踐,以增強(qiáng)自己的動手能力。這次實(shí)習(xí)十分有意義,這次實(shí)習(xí)我們知道了理論和實(shí)踐的距離,也知道了理論和實(shí)踐相結(jié)合的重要性。

回顧起此次課程設(shè)計(jì),感覺受益匪淺,從拿到題目到完成整個(gè)編程,從理論到實(shí)踐,學(xué)到很多很多的課堂理論中沒學(xué)到過的東西,不僅對鍵盤的識別技術(shù)這一章節(jié)的知識點(diǎn)有了深刻的認(rèn)識,而且對這學(xué)期開設(shè)的單片機(jī)這門課程有了更全面的了解,尤其是在學(xué)習(xí)使用proteus軟件片編程和仿真時(shí)收獲良多。通過這次單片機(jī)課程設(shè)計(jì),還使我懂得了實(shí)踐的重要性。同時(shí)在程序調(diào)試的過程中提高自己的發(fā)現(xiàn)問題、解決問題、實(shí)際動手和獨(dú)立思考的能力。

這次課程設(shè)計(jì)能順利的完成,除了我們的努力外,當(dāng)然也離不開指導(dǎo)老師申老師的辛勤指導(dǎo),致使我在設(shè)計(jì)的過程中學(xué)到了很多實(shí)用性的知識。同時(shí),對給過我?guī)椭乃型瑢W(xué)和各位指導(dǎo)老師表示忠心的感謝!

附錄:程序清單

P1口閃亮:

ORG0000HLOOP:MOVP1,#01HACALLDELAYMOVP1,#00HACALLDELAYSJMPLOOPDELAY:MOVR7,#250DEL1:MOVR6,#250DJNZR6,$DJNZR7,DEL1RETEND

流水燈循環(huán)左移右移:方法一:

ORG0000HMOVA,#01HLOOP:MOVP1,AMOVR5,#10LOOP1:ACALLDELAYDJNZR5,LOOP1RLA

JBACC.7,LOOP2SJMPLOOPLOOP2:MOVP1,AMOVR5,#10LOOP3:ACALLDELAYDJNZR5,LOOP3RRA

JBACC.0,LOOPSJMPLOOP2DELAY:MOVR7,#250DEL1:MOVR6,#250DJNZR6,$DJNZR7,DEL1RETEND方法二:

ORG0000HMOVA,#80HLOOP:RLA

MOVP1,AACALLDELAY

CJNEA,#80H,LOOP

LOOP1:RRAMOVP1,AACALLDELAY

CJNEA,#01H,LOOP1SJMPLOOP

DELAY:MOVR7,#0FFHDELAY1:MOVR6,#0FFHDELAY2:MOVR5,#03HDELAY3:DJNZR5,DELAY3DJNZR6,DELAY2DJNZR7,DELAY1RETEND方法三:

ORG0000HMOVA,#80HMOVR0,#08HLOOP:RLAMOVP1,AACALLDELAY

DJNZR0,LOOPMOVR0,#07HLOOP1:RRAMOVP1,AACALLDELAYDJNZR0,LOOP1MOVR0,#07HSJMPLOOP

DELAY:MOVR7,#0FFHDELAY1:MOVR6,#0FFHDELAY2:MOVR5,#03HDELAY3:DJNZR5,DELAY3DJNZR6,DELAY2DJNZR7,DELAY1RETEND方法四:

ORG0000HMOVA,#00HSETBCYLOOP:RLCAJCLOOP1MOVP1,A

ACALLDELAY

SJMPLOOPLOOP1:RRCAJCLOOPMOVP1,AACALLDELAYSJMPLOOP1DELAY:MOVR7,#0FFHDELAY1:MOVR6,#0FFHDELAY2:MOVR5,#03HDELAY3:DJNZR5,DELAY3DJNZR6,DELAY2DJNZR7,DELAY1RETEND

從中間向兩邊,再從兩邊向中間循環(huán)點(diǎn)亮:

ORG0000HSTAR:MOVR0,#00HMOVR1,#07MOVA,R0

MOVDPTR,#TABLOOP:MOVCA,@A+DPTRMOVP1,AMOVR5,#10LOOP1:ACALLDELDJNZR5,LOOP1INCR0MOVA,R0DJNZR1,LOOPSJMPSTARDEL:MOVR7,#200DEL1:MOVR6,#250DJNZR6,$DJNZR7,DEL1RETTAB:DB

18H,24H,42H,81H,42H,24H,18HEND

鍵盤控制流水燈循環(huán)點(diǎn)亮:

按鍵P1.5P1.6控制循環(huán)燈移動方向ORG0000HAJMPMAINORG0003HAJMPETORG0030HMAIN:MOVSP,#60HSETBEASETBIT0SETBEX0CLRC

MOVA,#0FFHMOVP2,ALCALLDEL

LOOP:JNB21H.1,L;檢測標(biāo)志RRCA;右移動MOVP2,AAJMPDEE

L:RLCA;左移動MOVP2,ADEE:LCALLDELAJMPLOOPET:CLREAPUSHACCPUSHPSWLCALLDELAYMOVA,#0FFHMOVP1,ANOPNOP

MOVA,P1;讀鍵值A(chǔ)NLA,#0F0H

CJNEA,#0F0H,NEXT1AJMPNEXT

NEXT1:JBACC.5,NEXT2

CLR21H.1;按鍵后產(chǎn)生標(biāo)志AJMPNEXT

NEXT2:JBACC.6,NEXT

SETB21H.1;按鍵后產(chǎn)生標(biāo)志NEXT:SETBEAPOPPSWPOPACCHHH:RETI

DEL:MOVR6,#250DEL11:MOVR5,#250DJNZR5,$DJNZR6,DEL11RET

DELAY:MOVR6,#10DEL1:MOVR5,#200DEL2:DJNZR5,$DJNZR6,DEL1RETEND花樣流水燈:

ORG0000HSTART:MOVR0,#00HMOVP1,#00HLOOP:MOVA,R0ADDA,#0CHMOVCA,@A+PCCJNEA,#01H,XSHSJMPSTARTXSH:MOVP1,AACALLDELAYINCR0SJMPLOOP

DB0FFH,00H,0FFH,00H,0FFH,00H,0FFH,00H,0FH,0F0H,0FH,0F0H,0FH,0F0H,0FH

DB0F0H,0FH,0F0H,0AAH,55H,0AAH,55H,0AAH,55H,0AAH,55H,0AAH,55H,81H,42H

DB24H,18H,24H,42H,81H,42H,24H,18H,24H,42H,81H,42H,24H,18H,24H,42H,81H

DB42H,24H,18H,24H,42H,81H,03H,06H,0CH,18H,30H,60H,0C0H,60H,30H,18H,0CH

DB06H,03H,06H,0CH,18H,30H,60H,0C0H,60H,30H,18H,0CH,06H,03H,01HDELAY:MOVR7,#0FFHDELAY1:MOVR6,#0FFHDELAY2:MOVR5,#03HDELAY3:DJNZR5,DELAY3DJNZR6,DELAY2DJNZR7,DELAY1RETEND

1位靜態(tài)數(shù)碼顯示:ORG0000HMOVR0,#0FFHDISPLY:INCR0

CJNER0,#0AH,DISPLY1MOVR0,#0FFHSJMPDISPLYDISPLY1:MOVA,R0ADDA,#06HMOVCA,@A+PCMOVP0,AACALLDELAYSJMPDISPLY

DTAB:DB0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H

DB88H,83H,0C6H,0A1H,86H,8EH,0FFH,0CH,89H,7FH,0BFHDELAY:MOVR7,#0FFHDELAY1:MOVR6,#0FFHDELAY2:MOVR5,#03HDELAY3:DJNZR5,DELAY3DJNZR6,DELAY2DJNZR7,DELAY1RET

2位靜態(tài)數(shù)碼顯示:ORG0000HMOVR0,#0FFHMOVR1,#00HDISPLY:INCR0

CJNER0,#0AH,DISPLY1INCR1

CJNER1,#0AH,DISPLY2MOVR0,#0FFHMOVR1,#00HMOVP0,#0FFHAJMPDISPLYDISPLY2:MOVA,R1ADDA,#10HMOVCA,@A+PCMOVP0,AMOVR0,#0FFHAJMPDISPLYDISPLY1:MOVA,R0ADDA,#06HMOVCA,@A+PCMOVP2,AACALLDELAYAJMPDISPLYDTAB:DB

0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H

DB88H,83H,0C6H,0A1H,86H,8EH,0FFH,0CH,89H,7FH,0BFHDELAY:MOVR7,#0FFHDELAY1:MOVR6,#0FFHDELAY2:MOVR5,#03HDELAY3:DJNZR5,DELAY3DJNZR6,DELAY2DJNZR7,DELAY1RETEND

3位靜態(tài)數(shù)碼顯示:ORG0000HSTART:MOVR0,#0FFHMOVR1,#00HMOVR2,#00HMOVP3,#0FFHMOVP2,#0FFHMOVP0,#0FFHDISPLY:INCR0

CJNER0,#0AH,DISPLY1MOVR0,#0FFHINCR1

CJNER1,#0AH,DISPLY2MOVR1,#00HMOVP2,#0C0HINCR2

CJNER2,#0AH,DISPLY3SJMPSTARTDISPLY3:MOVA,R2ADDA,#16HMOVCA,@A+PCMOVP0,ASJMPDISPLYDISPLY2:MOVA,R1ADDA,#0EHMOVCA,@A+PCMOVP2,A

SJMPDISPLYDISPLY1:MOVA,R0ADDA,#06HMOVCA,@A+PCMOVP3,AACALLDELAYSJMPDISPLY

DTAB:DB0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H

DB88H,83H,0C6H,0A1H,86H,8EH,0FFH,0CH,89H,7FH,0BFHDELAY:MOVR7,#0FFHDELAY1:MOVR6,#0FFHDELAY2:MOVR5,#03HDELAY3:DJNZR5,DELAY3DJNZR6,DELAY2DJNZR7,DELAY1RETEND

4位靜態(tài)數(shù)碼顯示:ORG0000HSTART:MOVR0,#0FFHMOVR1,#00HMOVR2,#00HMOVR3,#00HMOVP1,#0FFHMOVP3,#0FFHMOVP2,#0FFHMOVP0,#0FFHDISPLY:INCR0

CJNER0,#0AH,DISPLY1MOVR0,#0FFHINCR1

CJNER1,#0AH,DISPLY2MOVR1,#00HMOVP3,#0C0HINCR2

CJNER2,#0AH,DISPLY3MOVR2,#00HMOVP2,#0C0HINCR3

CJNER3,#0AH,DISPLY4SJMPSTARTDISPLY4:MOVA,R3ADDA,#1EHMOVCA,@A+PCMOVP0,ASJMPDISPLYDISPLY3:MOVA,R2ADDA,#16HMOVCA,@A+PCMOVP2,ASJMPDISPLYDISPLY2:MOVA,R1ADDA,#0EHMOVCA,@A+PCMOVP3,A

SJMPDISPLYDISPLY1:MOVA,R0ADDA,#06HMOVCA,@A+PCMOVP1,AACALLDELAYSJMPDISPLY

DTAB:DB0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H

DB88H,83H,0C6H,0A1H,86H,8EH,0FFH,0CH,89H,7FH,0BFHDELAY:MOVR7,#0AHDELAY1:MOVR6,#0FFHDELAY2:MOVR5,#03HDELAY3:DJNZR5,DELAY3DJNZR6,DELAY2DJNZR7,DELAY1RETEND

74HC595四位穩(wěn)定顯示:1)最大數(shù)為9999的計(jì)數(shù)器ORG0000HAJMPMAINORG000BHAJMPCRT0ORG0020HMAIN:MOVR1,#33HMOVR2,#04HCLEAR:MOV@R1,#33HDECR1

DJNZR2,CLEARMOVSP,#60HMOVTMOD,#01HMOVTH0,#3CH

MOVTL0,#0B0HSETBEA

SETBET0SETBTR0

MOVR7,#1

MOVDPTR,#DTABLOOP:MOVR1,#33HMOVR2,#04HMOVR3,#08HMOVR4,#01HLOOP1:MOVA,R3MOVP2,ARRA

MOVR3,AMOVA,@R1

CJNER4,#00H,MODEXSH:LCALLDISLCALLDEL

DECR1

DJNZR2,LOOP1

AJMPLOOP

MODE:CJNEA,#00H,FHMOVR4,#01HMOVA,#0AHSJMPXSHFH:MOVR4,#00HSJMPXSHCRT0:DJNZR7,RRRMOVR7,#1INC30HMOVR0,30H

CJNER0,#0AH,RRRMOV30H,#00HINC31HMOVR0,31H

CJNER0,#0AH,RRRMOV31H,#00HINC32HMOVR0,32H

CJNER0,#0AH,RRRMOV32H,#00HINC33HMOVR0,33H

CJNER0,#0AH,RRRMOV33H,#00HRRR:MOVTH0,#3CHMOVTL0,#0B0HRETI

DIS:MOVCA,@A+DPTRMOVP0,ARET

DEL:MOVR6,#20DEL1:MOVR5,#150DEL2:DJNZR5,$DJNZR6,DEL1RETDTAB:DB

0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H,0FFHDB

88H,83H,0C6H,0A1H,86H,8EH,0FFH,0CH,89H,7FH,0BFHEND

2)最高位為零時(shí),最高位不顯示ORG0000HAJMPMAINORG000BHAJMPCRT0ORG0020HMAIN:MOVR1,#33HMOVR2,#04HCLEAR:MOV@R1,#00HDECR1

DJNZR2,CLEARMOVSP,#60HMOVTMOD,#01HMOVTH0,#3CHMOVTL0,#0B0HSETBEASETBET0SETBTR0MOVR7,#1

MOVDPTR,#DTABLOOP:MOVR1,#33HMOVR2,#04HMOVR3,#08HLOOP1:MOVA,R3MOVP2,ARRAMOVR3,AMOVA,@R1LCALLDISLCALLDELDECR1

DJNZR2,LOOP1AJMPLOOPCRT0:DJNZR7,RRRMOVR7,#1MOVR0,#30HMOVR4,04HCON:INC@R0

CJNE@R0,#0AH,RRRMOV@R0,#00HINCR0

DJNZR4,CONRRR:MOVTH0,#3CHMOVTL0,#0B0HRETI

DIS:MOVCA,@A+DPTRMOVP0,ARET

DEL:MOVR6,#20DEL1:MOVR5,#150DEL2:DJNZR5,$DJNZR6,DEL1RET

DTAB:DB0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H,0FFH

DB88H,83H,0C6H,0A1H,86H,8EH,0FFH,0CH,89H,7FH,0BFHEND

3)最大數(shù)為256的計(jì)數(shù)器DATDATA30HBWDATA31HSHWDATA32HGWDATA33HORG0000HAJMPMAINORG000BHAJMPCOUNTORG0030HMAIN:MOVSP,#60HMOVTMOD,#01HMOVTH0,#3CHMOVTL0,#0B0HSETBEASETBET0SETBTR0MOVR7,#2MOVDAT,#00HLOOP:LCALLCHANGEMOVP2,#01HMOVA,GWLCALLDISLCALLDELMOVP2,#02HMOVA,SHWLCALLDISLCALLDELMOVP2,#04HMOVA,BWLCALLDISLCALLDELMOVP2,#08HMOVA,#0AHLCALLDISLCALLDELAJMPLOOPCOUNT:DJNZR7,RRRMOVR7,#2INCDAT

RRR:MOVTH0,#3CHMOVTL0,#0B0HRETI

CHANGE:MOVA,DATMOVB,#100DIVABMOVBW,AMOVA,#10XCHA,BDIVABMOVSHW,AMOVGW,BRET

DIS:MOVDPTR,#TABMOVCA,@A+DPTRMOVP0,ARET

DEL:MOVR6,#20DEL1:MOVR5,#150DEL2:DJNZR5,$DJNZR6,DEL1RET

TAB:DB0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H,0FFHEND

74LS4位靜態(tài)數(shù)碼顯示:方法一:ORG0000HMOVR3,#04HMOVR0,#20HSTART:LCALLDISPLAYLCALLCOUNTLCALLDELAYSJMPSTARTCOUNT:INC@R0

CJNE@R0,#0AH,DONMOV@R0,#00HSHW:INCR0INC@R0

CJNE@R0,#0AH,DE1

MOV@R0,#00HBW:INCR0INC@R0

CJNE@R0,#0AH,DE2MOV@R0,#00HQW:INCR0INC@R0

CJNE@R0,#0AH,DE3MOV@R0,#00HDE3:DECR0DE2:DECR0DE1:DECR0DON:RET

DISPLAY:MOVSCON,#00HLOOP:MOVA,@R0ADDA,#0FHMOVCA,@A+PCMOVSBUF,AJNBTI,$CLRTIINCRDJNZR3,LOOPMOVR3,#04HMOVR0,#20HDON1:RET

DTAB:DB3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH

DB77H,7CH,39H,5EH,79H,71H,00H,0F3H,76H,80H,40HDELAY:MOVR7,#50DELAY1:MOVR6,#100DELAY2:MOVR5,#20DJNZR5,$DJNZR6,DELAY2DJNZR7,DELAY1RETEND

方法二:ORG0000HAJMPMAINORG000BHAJMPCOUNTORG0020HMAIN:MOVR1,#30HMOVR2,#04HCLEAR:MOV@R1,#00HINCR1

DJNZR2,CLEARMOVSP,#60HMOVTMOD,#01HMOVTH0,#0B0HSETBEASETBET0SETBTR0MOVR3,#3

MOVDPTR,#DTABMOVSCON,#00HDISPLY:MOVR1,#30HMOVR2,#04HLOOP:MOVA,@R1

MOVCA,@A+DPTRMOVSBUF,AJNBTI,$CLRTIINCR1

DJNZR2,LOOPACALLDELSJMPLOOPCOUNT:DJNZR3,RRRMOVR3,#3MOVR0,#30HMOVR4,#04HCON:INC@R0

CJNE@R0,#0AH,RRRMOV@R0,#00HINCR0

DJNZR4,CONRRR:MOVTH0,#3CHMOVTL0,#0B0HRETI

DEL:MOVR6,#250DEL1:MOVR5,#250DEL2:DJNZR5,$DJNZR6,DEL1RET

DTAB:DB3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH

DB77H,7CH,39H,5EH,79H,71H,00H,0F3H,76H,80H,40HEND

動態(tài)數(shù)碼顯示:

ORG0000HACALLSTART

START1:MOV@R0,#00HINCR0

DJNZR2,START1ACALLSTART2

COUNT:CJNE@R0,#0AH,ACALLDISMOV@R0,#00HINCR0INC@R0

CJNER0,#34H,COUNTACALLSTARTAJMPSTART1ACALLDIS:ACALLDISPLAYINC@R0AJMPCOUNTDISPLAY:ACALLSTARTMOVR4,#01HDISPLAY1:MOVA,@RMOVDPTR,#DTABMOVCA,@A+DPTRMOVP0,AINCR0MOVA,R3MOVP2,ARLA

MOVR3,AACALLDELAY

DJNZR2,DISPLAY1ACALLSTART

DJNZR4,DISPLAY1RETDTAB:DB

3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH

DB77H,7CH,39H,5EH,79H,71H,00H,0F3H,76H,80H,40HSTART:MOVR3,#0FEHSTART2:MOVR0,#34HMOVR2,#04HRET

DELAY:MOVR7,#088HDEL1:MOVR6,#88HDEL2:MOVR5,#01HDEL3:DJNZR5,DEL3DJNZR6,DEL2DJNZR7,DEL1RETEND

獨(dú)立鍵盤加減清零數(shù)碼顯示:#include

#defineucharunsignedchar#defineuintunsignedintsbitkey1=P3^4;sbitkey2=P3^5;sbitkey3=P3^6;sbitkey4=P3^7;sbitdula=P2^6;sbitwela=P2^7;ucharcodetable[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};voiddelayms(uint);ucharnumt0,num;voiddisplay(numdis){ucharshi,ge;shi=numdis/10;ge=numdis%10;wela=1;P0=0xfe;wela=0;dula=1;

P0=table[shi];dula=0;P0=0xff;delayms(5);wela=1;P0=0xfd;wela=0;dula=1;

P0=table[ge];dula=0;P0=0xff;

delayms(5);}

voiddelayms(uintx){uinti,j;

for(i=x;i>0;i--)

for(j=110;j>0;j--);}voidinit(){TMOD=0x01;

TH0=(65536-50000)/256;TL0=(65536-50000)%256;EA=1;ET0=1;}

voidkeyscan(){if(key1==0){delayms(10);if(key1==0){num++;

if(num==60)num=0;

while(!key1);}}if(key2==0){delayms(10);if(key2==0){if(num==0)num=60;num--;

while(!key2);}}if(key3==0){delayms(10);if(key3==0){num=0;

while(!key2);}}if(key4==0){delayms(10);if(key4==0)

{while(!key4);TR0=~TR0;}}}voidmain(){init();while(1){keyscan();

display(num);}}

voidT0_time()interrupt1{TH0=(65536-50000)/256;TL0=(65536-50000)%256;numt0++;

if(numt0==20){numt0=0;num++;

if(num==60)num=0;}}

矩陣鍵盤0到F顯示:KEY_DATADATA30HORG0000H

MOVKEY_DATA,#10HAJMPMAINORG0030HMAIN:MOVSP,#60HLOOP:LCALLSCANMOVA,KEY_DATAMOVDPTR,#TABMOVCA,@A+DPTRMOVP0,ALCALLDELAJMPLOOP

SCAN:MOVA,#0FHMOVP1,AMOVA,P1

CJNEA,#0FH,KEYSCANRET

KEYSCAN:LCALLDELMOVR2,#7FHMOVR3,#4MOVR0,#00HKEYSM1:MOVA,R2MOVP1,ARRAMOVR2,AMOVA,P1ANLA,#0FH

CJNEA,#0FH,JSADDINCR0

DJNZR3,KEYSM1RET

JSADD:JBACC.0,JSADD1MOVA,#0AJMPJSADD4

JSADD1:JBACC.1,JSADD2MOVA,#4AJMPJSADD4

JSADD2:JBACC.2,JSADD3MOVA,#8AJMPJSADD4

JSADD3:JBACC.3,JSADD4MOVA,#12JSADD4:ADDA,R0

MOVKEY_DATA,ADEL:MOVR6,#50DEL1:MOVR5,#200DJNZR5,$DJNZR6,DEL1RET

TAB:DB0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H

DB88H,83H,0C6H,0A1H,86H,8EH,0FFH,0CH,89H,7FH,0BFHEND

友情提示:本文中關(guān)于《單片機(jī)實(shí)訓(xùn)總結(jié)》給出的范例僅供您參考拓展思維使用,單片機(jī)實(shí)訓(xùn)總結(jié):該篇文章建議您自主創(chuàng)作。

來源:網(wǎng)絡(luò)整理 免責(zé)聲明:本文僅限學(xué)習(xí)分享,如產(chǎn)生版權(quán)問題,請聯(lián)系我們及時(shí)刪除。


單片機(jī)實(shí)訓(xùn)總結(jié)》由互聯(lián)網(wǎng)用戶整理提供,轉(zhuǎn)載分享請保留原作者信息,謝謝!
鏈接地址:http://www.7334dd.com/gongwen/522642.html