鍵盤(pán)控制液晶屏dsp_第1頁(yè)
鍵盤(pán)控制液晶屏dsp_第2頁(yè)
鍵盤(pán)控制液晶屏dsp_第3頁(yè)
鍵盤(pán)控制液晶屏dsp_第4頁(yè)
鍵盤(pán)控制液晶屏dsp_第5頁(yè)
已閱讀5頁(yè),還剩29頁(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í)習(xí)題目指導(dǎo)教師職 稱(chēng)學(xué)生姓名學(xué) 號(hào)日 期實(shí)習(xí)題目指導(dǎo)教師職 稱(chēng)學(xué)生姓名學(xué) 號(hào)日 期內(nèi)蒙古師范大學(xué)計(jì)算機(jī)與信息工程學(xué)院數(shù)字信號(hào)處理課程設(shè)計(jì)報(bào)告實(shí)習(xí)題目指導(dǎo)教師職 稱(chēng)學(xué)生姓名學(xué) 號(hào)日 期設(shè)計(jì)題目利用鍵盤(pán)控制液晶屏的顯示指導(dǎo)教師郭改枝職稱(chēng)教授姓 名學(xué) 號(hào)日 期2013年6月20日利用鍵盤(pán)控制液晶屏的顯示指導(dǎo)教師 郭改枝 講師摘要 本系統(tǒng)包括DSP 對(duì)語(yǔ)音信號(hào)的處理、鍵盤(pán)控制、液晶屏顯示幾部分。DSP 作為主芯片實(shí)現(xiàn)各模塊之間的通信,其主要工作有:上電自舉,讀取鍵盤(pán)值并初始化液晶屏,通過(guò)液晶屏顯示鍵盤(pán)的碼值。同時(shí),本設(shè)計(jì)在程序編寫(xiě)部分很好地將匯編語(yǔ)言與C語(yǔ)言結(jié)合起來(lái),體現(xiàn)了語(yǔ)言之間的聯(lián)系性,成功地利

2、用鍵盤(pán)控制了液晶屏并顯示了鍵碼值。關(guān)鍵詞 上電自舉;中斷; 讀取鍵碼;液晶顯示1系統(tǒng)總體概況1.1總體描述鍵盤(pán)的按鍵按下,表示一次中斷,每次中斷,DSP轉(zhuǎn)向中斷服務(wù)程序并且講鍵碼值送到液晶屏并顯示出來(lái)。1.2程序框圖2.系統(tǒng)的組成部分2.1鍵盤(pán)模塊2.1.1鍵盤(pán)說(shuō)明鍵盤(pán)矩陣的行線和列線分別映射為DSP的IO空間的某個(gè)地址的數(shù)據(jù)線,行線的輸出狀態(tài)通過(guò)讀IO空間的數(shù)據(jù)獲得,列線的輸入狀態(tài)通過(guò)向IO空間寫(xiě)數(shù)據(jù)實(shí)現(xiàn)。實(shí)現(xiàn)鍵盤(pán)有兩種方案:一是采用現(xiàn)有的一些芯片實(shí)現(xiàn)鍵盤(pán)掃描;另一種就是用軟件實(shí)現(xiàn)鍵盤(pán)掃描。這里就介紹一下軟鍵盤(pán)的實(shí)現(xiàn)方案。 圖2-1通常在一個(gè)鍵盤(pán)中使用了一個(gè)瞬時(shí)接觸開(kāi)關(guān),并且用如上圖2-1所

3、示的簡(jiǎn)單電路,微處理器可以容易地檢測(cè)到閉合。當(dāng)開(kāi)關(guān)打開(kāi)時(shí),通過(guò)處理器的I/O口的一個(gè)上拉電阻提供邏輯1;當(dāng)開(kāi)關(guān)閉合時(shí),處理器的I/O口的輸入將被拉低得到邏輯0??蛇z憾的是,開(kāi)關(guān)并不完善,因?yàn)楫?dāng)它們被按下或者被釋放時(shí),并不能夠產(chǎn)生一個(gè)明確的1或者0。盡管觸點(diǎn)可能看起來(lái)穩(wěn)定而且很快地閉合,但與微處理器快速的運(yùn)行速度相比,這種動(dòng)作是比較慢的。當(dāng)觸點(diǎn)閉合時(shí),其彈起就像一個(gè)球。彈起效果將產(chǎn)生如圖8-2所示的好幾個(gè)脈沖。彈起的持續(xù)時(shí)間通常將維持在5ms30ms之間。如果需要多個(gè)鍵,則可以將每個(gè)開(kāi)關(guān)連接到微處理器上它自己的輸入端口。然而,當(dāng)開(kāi)關(guān)的數(shù)目增加時(shí),這種方法將很快使用完所有的輸入端口。鍵盤(pán)上陣列這些

4、開(kāi)關(guān)最有效的方法(當(dāng)需要5個(gè)以上的鍵時(shí))就形成了一個(gè)如圖8-3所示的二維矩陣。當(dāng)行和列的數(shù)目一樣多時(shí),也就是方型的矩陣,將產(chǎn)生一個(gè)最優(yōu)化的布列方式(I/O端被連接的時(shí)候)。一個(gè)瞬時(shí)接觸開(kāi)關(guān)(按鈕)放置在每一行與線一列的交叉點(diǎn)。矩陣所需的鍵的數(shù)目顯然根據(jù)應(yīng)用程序而不同。每一行由一個(gè)輸出端口的一位驅(qū)動(dòng),而每一列由一個(gè)電阻器上拉且供給輸入端口一位。圖2-2 按鍵抖動(dòng) 圖2-3 矩陣鍵盤(pán) 鍵盤(pán)掃描過(guò)程就是讓微處理器按有規(guī)律的時(shí)間間隔查看鍵盤(pán)矩陣,以確定是否有鍵被按下。一旦處理器判定有一個(gè)鍵按下,鍵盤(pán)掃描軟件將過(guò)濾掉抖動(dòng)并且判定哪個(gè)鍵被按下。每個(gè)鍵被分配一個(gè)稱(chēng)為掃描碼的唯一標(biāo)識(shí)符。應(yīng)用程序利用該掃描碼,

5、根據(jù)按下的鍵來(lái)判定應(yīng)該采取什么行動(dòng)。換句話說(shuō),掃描碼將告訴應(yīng)用程序按下哪個(gè)鍵。 2.1.2鍵盤(pán)掃描算法 在初始化階段,所有的行(輸出端口)被強(qiáng)行設(shè)置為低電平。在沒(méi)有任何鍵按下時(shí)。所有的列(輸入端口)將讀到高電平。任何鍵的閉合將造成其中的一列變?yōu)榈碗娖?。為了查看是否有一個(gè)鍵已經(jīng)被按下,微處理器僅僅需要查看任一列的值是否變成低電平。一旦微處理器檢測(cè)到有鍵被按下,就需要找出是哪一個(gè)鍵。過(guò)程很簡(jiǎn)單,微處理器只需在其中一行上輸出一個(gè)低電平。如果它在輸入端口上發(fā)現(xiàn)一個(gè)0值,該微處理器就知道在所選擇行上產(chǎn)生了鍵的閉合。相反,如果輸入端口全是高電平,則被按下的鍵就不在那一行,微處理器將選擇下一行,并重復(fù)該過(guò)程

6、直到它發(fā)現(xiàn)了該行為止。一旦該行被識(shí)別出來(lái),則被按下鍵的具體的列可以通過(guò)鎖定輸入端口上唯一的低電位來(lái)確定。微處理器執(zhí)行這些步驟所需要的時(shí)間與最小的狀態(tài)閉合時(shí)間相比是非常短的,因此它假設(shè)該鍵在這個(gè)時(shí)間間隔中將維持按下的狀態(tài)。比如:當(dāng)發(fā)現(xiàn)某列變?yōu)榈碗娖綍r(shí),此時(shí)微處理器僅在某一行上輸出低電平,再查看列的狀態(tài),如果此時(shí)在輸入端口上發(fā)現(xiàn)了一個(gè)0,則就可以斷定就是此行上的鍵按下了,反之,如果輸入端口上全為1,則就不是這一行上按下了鍵。根據(jù)第一步和第二步中得到的值,便可以得到相應(yīng)的掃描碼。比如,第一步中行全為零時(shí)列輸入B1為零,當(dāng)將輸出的第二行B2置為零時(shí),如果此時(shí)的列輸入B1仍為零,則可得到掃描碼為。 2.

7、2液晶屏模塊2.2.1液晶屏說(shuō)明另一種便僅是LCD顯示屏,沒(méi)有驅(qū)動(dòng)電路,需要與驅(qū)動(dòng)電路配合使用。特點(diǎn)是體積小,但是卻需要另外的驅(qū)動(dòng)芯片。也可以使用帶有LCD驅(qū)動(dòng)能力的高檔MCU驅(qū)動(dòng)。本實(shí)驗(yàn)我們使用的是帶有驅(qū)動(dòng)電路的LCD顯示模塊,采用DSP的總線方式來(lái)驅(qū)動(dòng)。 一般帶有驅(qū)動(dòng)模塊的LCD顯示屏使用這種驅(qū)動(dòng)方式,由于LCD已經(jīng)帶有驅(qū)動(dòng)硬件電路,因此模塊給出的是總線接口,便于與單片機(jī)的總線進(jìn)行接口。驅(qū)動(dòng)模塊具有八位數(shù)據(jù)總線,外加一些電源接口和控制信號(hào)。而且還自帶顯示緩存,只需要將要顯示的內(nèi)容送到顯示緩存中就可以實(shí)現(xiàn)內(nèi)容的顯示。由于只有八條數(shù)據(jù)線,因此常常通過(guò)引腳信號(hào)來(lái)實(shí)現(xiàn)地址與數(shù)據(jù)線復(fù)用,以達(dá)到把相應(yīng)

8、數(shù)據(jù)送到相應(yīng)顯示緩存的目的。2.2.2指令表指令代碼功能R/WD/ID7D6D5D4D3D2D1D0顯示開(kāi)/關(guān)0010101111/0不論顯示隨機(jī)存儲(chǔ)數(shù)據(jù)或內(nèi)部狀態(tài)如何,將顯示打開(kāi)或關(guān)閉1: 開(kāi) 0: 關(guān)顯示起始線00110顯示起始線(031)指定隨機(jī)存儲(chǔ)數(shù)據(jù)在顯示器頂端顯示 (公共端0)編碼 地址設(shè)定00101110頁(yè):(03)設(shè)置頁(yè)地址(頁(yè)地址) 列(段) 地址設(shè)定000列地址(079)設(shè)置列地址(列地址)狀態(tài)讀取10busyADC開(kāi)/關(guān)RST0000讀狀態(tài)busy 1:I內(nèi)部操作 0:準(zhǔn)備就緒ADC 1:右向輸出 0:左向RST 1:重啟 0:正常開(kāi)/關(guān) 1:顯示關(guān) 0:顯示開(kāi)寫(xiě)顯示數(shù)據(jù)

9、01寫(xiě)數(shù)據(jù)將數(shù)據(jù)總線中數(shù)據(jù)寫(xiě)入顯存讀顯示數(shù)據(jù)11讀數(shù)據(jù)將顯存數(shù)據(jù)讀入數(shù)據(jù)總線ADC 選擇0010100000/1指定對(duì)顯存數(shù)據(jù)順時(shí)針讀取或逆時(shí)針讀取0: 順時(shí)針1: 逆時(shí)針靜態(tài)驅(qū)動(dòng) 開(kāi)/關(guān)0010100100/1選擇動(dòng)態(tài)或靜態(tài)驅(qū)動(dòng)1: 靜態(tài)驅(qū)動(dòng)0: 動(dòng)態(tài)驅(qū)動(dòng)占空比選擇0010101000/1選擇占空比1:1/32H0:1/16RMW0011100000寫(xiě)操作時(shí)對(duì)列地址寄存器賦增量。讀操作時(shí)不作改變。中止0011101110結(jié)束RWM模式重啟0011100010設(shè)置顯示器起始線寄存器為第1行,列地址寄存器以及編碼地址寄存器為第0行 節(jié)能模式(雙重指令)00000011001100111001關(guān)閉

10、顯示器以及打開(kāi)靜態(tài)驅(qū)動(dòng),從而設(shè)置節(jié)能模式3.程序代碼第一部分是鍵盤(pán)控制液晶屏的總體程序設(shè)計(jì),實(shí)現(xiàn)了利用鍵盤(pán)控制液晶屏并顯示代碼。具體程序見(jiàn)附件一。第二部分是初始化程序,將各個(gè)寄存器,計(jì)數(shù)器,中斷等初始化。具體程序見(jiàn)附件二。第三部分是命令程序,設(shè)置各個(gè)部分的位置等。具體程序見(jiàn)附件三。4 .小結(jié) 通過(guò)近兩周的課程設(shè)計(jì),我終于體會(huì)到實(shí)踐是檢驗(yàn)真理的唯一標(biāo)準(zhǔn)這句話的含義,只有不斷的實(shí)踐,不斷的發(fā)現(xiàn)錯(cuò)誤,不斷的反思自己,才能一步步做出完美的結(jié)果。通過(guò)這次設(shè)計(jì),我學(xué)到了以下幾點(diǎn):1. 要想實(shí)現(xiàn)自己的小小目標(biāo),必須要有鍥而不舍的精神,要有百折不撓,不怕錯(cuò),不怕輸?shù)木瘛?. 合作是相當(dāng)重要的。沒(méi)有李哲的全力

11、付出,沒(méi)有他的堅(jiān)持,我們是不可能做出來(lái)的,而且我發(fā)現(xiàn)我的合作者具有很強(qiáng)的動(dòng)手實(shí)踐能力,這一點(diǎn)是我不具備的,在此向他學(xué)習(xí)。而我發(fā)現(xiàn)的都是小問(wèn)題,而他動(dòng)手能力又這么強(qiáng),為此為有如此厲害的合作者高興。3. 提高了我的自學(xué)能力。很多知識(shí)是自己不會(huì)的,比如仿真軟件的使用,通過(guò)查閱資料,上網(wǎng)學(xué)習(xí),最終學(xué)到了有用的東西。4. 鞏固了我的專(zhuān)業(yè)知識(shí),包括平時(shí)學(xué)的書(shū)本上的理論知識(shí)。最后,在整個(gè)設(shè)計(jì)實(shí)現(xiàn)過(guò)程中,得到了郭改枝老師的鼓勵(lì)與精心指導(dǎo),在此表示衷心的感謝!參考文獻(xiàn)1 劉艷萍 李志軍,DSP技術(shù)原理及應(yīng)用教程(第3版) 北京航空航天出版社.2 劉修文,電子控制電路300例,機(jī)械工業(yè)出版社,2005年4月.附件

12、一:利用鍵盤(pán)控制液晶屏的顯示#include /*-*/void Wr_c_l(char com);void Wr_c_r(char com);void Wr_d_l(char data);void Wr_d_r(char data);void Init_Lcd();void Cls_Lcd();void lcd_dsp(char lorr,char page_cnt,char line,char numx);char temp,clr_page_cnt,clr_byte_cnt,page_cnt,colm_cnt;ioport unsigned port0800;/lcd dataioiop

13、ort unsigned port1000;/lcd resetioport unsigned port0c00;/lcd diioport unsigned port1400;/lcd cs1ioport unsigned port1800;/lcd cs2ioport unsigned port2C00;/faguangchar num0 =0,0x3E,0x51,0x49,0x45,0x3E,0x00,0x00;/0=00Hchar num1 =0,0x00,0x42,0x7F,0x40,0x00,0x00,0x00;/1=01Hchar num2 =0,0x42,0x61,0x51,0

14、x49,0x46,0x00,0x00;/2=02Hchar num3 =0,0x21,0x41,0x45,0x4B,0x31,0x00,0x00;/3=03Hchar num4 =0,0x18,0x14,0x12,0x7F,0x10,0x00,0x00;/4=04Hchar num5 =0,0x27,0x45,0x45,0x45,0x39,0x00,0x00;/5=05Hchar num6 =0,0x3C,0x4A,0x49,0x49,0x30,0x00,0x00;/6=06Hchar num7 =0,0x01,0x01,0x79,0x05,0x03,0x00,0x00;/7=07Hchar

15、num8 =0,0x36,0x49,0x49,0x49,0x36,0x00,0x00;/8=08Hchar num9 =0,0x06,0x49,0x49,0x29,0x1E,0x00,0x00;/9=09Hchar numa =0,0x14,0x08,0x3E,0x08,0x14,0x00,0x00;/*=0AHchar numb =0,0x08,0x08,0x3E,0x08,0x08,0x00,0x00;/+=0BHchar numc =0,0x00,0x50,0x30,0x00,0x00,0x00,0x00;/,=0CHchar numd =0,0x08,0x08,0x08,0x08,0x

16、08,0x00,0x00;/-=0DHchar nume =0,0x00,0x60,0x60,0x00,0x00,0x00,0x00;/.=0EHchar numf =0,0x20,0x10,0x08,0x04,0x02,0x00,0x00;/=0FHchar num10=0,0x32,0x49,0x79,0x41,0x3E,0x00,0x00;/=10Hchar num11=0,0x00,0x00,0x4F,0x00,0x00,0x00,0x00;/!=1lHchar num12=0,0x00,0x07,0x00,0x07,0x00,0x00,0x00;/=12Hchar num13=0,0

17、x14,0x7F,0x14,0x7F,0x14,0x00,0x00;/#=13Hchar num14=0,0x24,0x2A,0x7F,0x2A,0x12,0x00,0x00;/$=14Hchar num15=0,0x23,0x13,0x08,0x64,0x62,0x00,0x00;/%=15Hchar num16=0,0x36,0x49,0x55,0x22,0x50,0x00,0x00;/&=16Hchar num17=0,0x00,0x05,0x03,0x00,0x00,0x00,0x00;/=17Hchar num18=0,0x00,0x1C,0x22,0x41,0x00,0x00,0x

18、00;/(=18Hchar num19=0,0x00,0x41,0x22,0x1C,0x00,0x00,0x00;/)=19Hchar num1a=0,0x00,0x36,0x36,0x00,0x00,0x00,0x00;/:=1AHchar num1b=0,0x00,0x56,0x36,0x00,0x00,0x00,0x00;/;=1BHchar num1c=0,0x08,0x14,0x22,0x41,0x00,0x00,0x00;/=1EHchar num1f=0,0x02,0x01,0x51,0x09,0x06,0x00,0x00;/?=1FHchar num20=0,0x00,0x00

19、,0x00,0x00,0x00,0x00,0x00;/ =20Hchar num21=0xF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF;/ =21Hchar num22=0,0x7E,0x11,0x11,0x11,0x7E,0x00,0x00;/A=22Hchar num23=0,0x41,0x7F,0x49,0x49,0x36,0x00,0x00;/B=23Hchar num24=0,0x3E,0x41,0x41,0x41,0x22,0x00,0x00;/C=24Hchar num25=0,0x41,0x7F,0x41,0x41,0x3E,0x00,0x00;/D

20、=25Hchar num26=0,0x7F,0x49,0x49,0x49,0x49,0x00,0x00;/E=26Hchar num27=0,0x7F,0x09,0x09,0x09,0x01,0x00,0x00;/F=27Hchar num28=0,0x3E,0x41,0x41,0x49,0x7A,0x00,0x00;/G=28Hchar num29=0,0x7F,0x08,0x08,0x08,0x7F,0x00,0x00;/H=29Hchar num2a=0,0x00,0x41,0x7F,0x41,0x00,0x00,0x00;/I=2AHchar num2b=0,0x20,0x40,0x4

21、1,0x3F,0x01,0x00,0x00;/J=2BHchar num2c=0,0x7F,0x08,0x14,0x22,0x41,0x00,0x00;/K=2CHchar num2d=0,0x7F,0x40,0x40,0x40,0x40,0x00,0x00;/L=2DHchar num2e=0,0x7F,0x02,0x00,0x02,0x7F,0x00,0x00;/M=2EHchar num2f=0,0x7F,0x06,0x08,0x30,0x7F,0x00,0x00;/N=2FHchar num30=0,0x3E,0x41,0x41,0x41,0x3E,0x00,0x00;/O=30Hch

22、ar num31=0,0x7F,0x09,0x09,0x09,0x06,0x00,0x00;/P=31Hchar num32=0,0x3E,0x41,0x51,0x21,0x5E,0x00,0x00;/Q=32Hchar num33=0,0x7F,0x09,0x19,0x29,0x46,0x00,0x00;/R=33Hchar num34=0,0x26,0x49,0x49,0x49,0x32,0x00,0x00;/S=34Hchar num35=0,0x01,0x01,0x7F,0x01,0x01,0x00,0x00;/T=35Hchar num36=0,0x3F,0x40,0x40,0x40

23、,0x3F,0x00,0x00;/U=36Hchar num37=0,0x1F,0x20,0x40,0x20,0x1F,0x00,0x00;/V=37Hchar num38=0,0x7F,0x20,0x18,0x20,0x7F,0x00,0x00;/W=38Hchar num39=0,0x63,0x14,0x08,0x14,0x63,0x00,0x00;/X=39Hchar num3a=0,0x07,0x08,0x70,0x08,0x07,0x00,0x00;/Y=3AHchar num3b=0,0x61,0x51,0x49,0x45,0x43,0x00,0x00;/Z=3BHchar num

24、3c=0,0x00,0x7F,0x41,0x41,0x00,0x00,0x00;/=3CHchar num3d=0,0x02,0x04,0x08,0x10,0x20,0x00,0x00;/=3DHchar num3e=0,0x00,0x41,0x41,0x7F,0x00,0x00,0x00;/=3EHchar num3f=0,0x04,0x02,0x01,0x02,0x04,0x00,0x00;/=3FHchar num40=0,0x40,0x40,0x40,0x40,0x40,0x00,0x00;/-=40Hchar num41=0,0x20,0x54,0x54,0x54,0x78,0x00

25、,0x00;/a=41Hchar num42=0,0x7F,0x48,0x44,0x44,0x38,0x00,0x00;/b=42Hchar num43=0,0x38,0x44,0x44,0x44,0x28,0x00,0x00;/c=43Hchar num44=0,0x38,0x44,0x44,0x48,0x7F,0x00,0x00;/d=44Hchar num45=0,0x38,0x54,0x54,0x54,0x18,0x00,0x00;/e=45Hchar num46=0,0x00,0x08,0x7E,0x09,0x02,0x00,0x00;/f=46Hchar num47=0,0x0C,

26、0x52,0x52,0x4C,0x3E,0x00,0x00;/g=47Hchar num48=0,0x7F,0x08,0x04,0x04,0x78,0x00,0x00;/h=48Hchar num49=0,0x00,0x44,0x7D,0x40,0x00,0x00,0x00;/i=49Hchar num4a=0,0x20,0x40,0x44,0x3D,0x00,0x00,0x00;/j=4AHchar num4b=0,0x00,0x7F,0x10,0x28,0x44,0x00,0x00;/k=4BHchar num4c=0,0x00,0x41,0x7F,0x40,0x00,0x00,0x00;

27、/I=4CHchar num4d=0,0x7C,0x04,0x78,0x04,0x78,0x00,0x00;/m=4DHchar num4e=0,0x7C,0x08,0x04,0x04,0x78,0x00,0x00;/n=4EHchar num4f=0,0x38,0x44,0x44,0x44,0x38,0x00,0x00;/o=4FHchar num50=0,0x7E,0x0C,0x12,0x12,0x0C,0x00,0x00;/p=50Hchar num51=0,0x0C,0x12,0x12,0x0C,0x7E,0x00,0x00;/q=51Hchar num52=0,0x7C,0x08,0

28、x04,0x04,0x08,0x00,0x00;/r=52Hchar num53=0,0x58,0x54,0x54,0x54,0x64,0x00,0x00;/s=53Hchar num54=0,0x04,0x3F,0x44,0x40,0x20,0x00,0x00;/t=54Hchar num55=0,0x3C,0x40,0x40,0x3C,0x40,0x00,0x00;/u=55Hchar num56=0,0x1C,0x20,0x40,0x20,0x1C,0x00,0x00;/v=56Hchar num57=0,0x3C,0x40,0x30,0x40,0x3C,0x00,0x00;/w=57H

29、char num58=0,0x44,0x28,0x10,0x28,0x44,0x00,0x00;/x=58Hchar num59=0,0x1C,0xA0,0xA0,0x90,0x7C,0x00,0x00;/y=59Hchar num5a=0,0x44,0x64,0x54,0x4C,0x44,0x00,0x00;/z=5AHchar num5b=0,0x00,0x08,0x36,0x41,0x00,0x00,0x00;/=5BHchar num5c=0,0x00,0x00,0x77,0x00,0x00,0x00,0x00;/|=5CHchar num5d=0,0x00,0x41,0x36,0x0

30、8,0x00,0x00,0x00;/=5DHchar num5e=0,0x02,0x01,0x02,0x04,0x02,0x00,0x00;/=5EHchar love1=0,0x40,0xB2,0x96,0x9A,0x92,0xF6,0x9A;char love2=0x93,0x91,0x99,0x97,0x91,0x90,0x30,0;char love3=0x40,0x20,0xA0,0x90,0x4C,0x47,0x2A,0x2A;char love4=0x12,0x1A,0x26,0x22,0x40,0xC0,0x40,0;char an11=0x10,0x10,0x10,0xFF,

31、0x90,0x20,0x98,0x88;char an12=0x88,0xE9,0x8E,0x88,0x88,0xA8,0x98,0x00;char an21=0x02,0x42,0x81,0x7F,0x00,0x00,0x80,0x84;char an22=0x4B,0x28,0x10,0x28,0x47,0x80,0x00,0x00;/*?,0*/char key13=0x40,0x30,0xEF,0x24,0x24,0x80,0xE4,0x9C;char key14=0x10,0x54,0x54,0xFF,0x54,0x7C,0x10,0x00;char key23=0x01,0x01,

32、0x7F,0x21,0x51,0x26,0x18,0x27;char key24=0x44,0x45,0x45,0x5F,0x45,0x45,0x44,0x00;/*?,1*/char shi15=0x00,0x00,0x00,0x7F,0x49,0x49,0x49,0x49;char shi16=0x49,0x49,0x49,0x7F,0x00,0x00,0x00,0x00;char shi25=0x81,0x41,0x21,0x1D,0x21,0x41,0x81,0xFF;char shi26=0x89,0x89,0x89,0x89,0x89,0x81,0x81,0x00;/*?,2*/c

33、har keyvalue1;/*To Decide The AIC Sample Frequency*/*-*/*DSP的IO空間,擴(kuò)展發(fā)光二極管、數(shù)碼管、鍵盤(pán)、液晶等外圍設(shè)備*/ioport unsigned port1C00;/鍵盤(pán)行列線/*-*/char rdkey() ;char scan_key();char keyvalue=255;void main() c54_init(); lcd_dsp(0,1,1,an11); lcd_dsp(0,1,2,an12); lcd_dsp(0,2,1,an21); lcd_dsp(0,2,2,an22); lcd_dsp(0,1,3,key1

34、3); lcd_dsp(0,1,4,key14); lcd_dsp(0,2,3,key23); lcd_dsp(0,2,4,key24); lcd_dsp(0,1,5,shi15); lcd_dsp(0,1,6,shi16); lcd_dsp(0,2,5,shi25); lcd_dsp(0,2,6,shi26);for (;) keyvalue = scan_key();if (keyvalue=255)asm( nop);/do nothingelse keyvalue1 = keyvalue;asm( nop);/do nothingasm( nop);/do nothing char r

35、dkey()char keyin;port1C00 = 0x0 ;keyin = port1C00 ;keyin = keyin & 0xF ; if (keyin = 0xF) return 0 ;else return 1 ;char scan_key()char keyornot;int keyin;int keyvalue; keyornot = rdkey() ; if (!keyornot) return 255; delay3(); keyornot = rdkey() ; if (keyornot )/某個(gè)鍵按下!port1C00 = 0xe ;keyin = port1C00

36、 & 0xF ;if ( keyin != 0xF)keyvalue = 0;keyin = keyin;keyvalue = keyin + keyvalue-7;while (keyornot = rdkey()/等鍵松下delay3();/return keyvalue;port1C00 = 0xd ;keyin = port1C00 & 0xF ;if ( keyin != 0xF)keyvalue = 1;keyvalue = keyin + keyvalue ;while (keyornot = rdkey()delay3();/return keyvalue;port1C00 =

37、 0xb ;keyin = port1C00 & 0xF ;if ( keyin != 0xF)keyvalue = 9;keyvalue = keyin + keyvalue ;while (keyornot = rdkey()delay3();/return keyvalue;port1C00 = 0x7 ;keyin = port1C00 & 0xF ;keyin = port1C00 & 0xF ;if ( keyin != 0xF)keyvalue = 17;keyvalue = keyin + keyvalue ;while (keyornot = rdkey()delay3();

38、/return keyvalue;if (keyvalue=0x7) keyvalue=0; goto proecess0; if (keyvalue=0x6) keyvalue=1; goto proecess1; if (keyvalue=0x4) keyvalue=2; goto proecess2; if (keyvalue=0x0) keyvalue=3; goto proecess3; if (keyvalue=0xf) keyvalue=4; goto proecess4; if (keyvalue=0xe) keyvalue=5; goto proecess5; if (key

39、value=0xc) keyvalue=6; goto proecess6; if (keyvalue=0x8) keyvalue=7; goto proecess7; if (keyvalue=0x17) keyvalue=8; goto proecess8; if (keyvalue=0x16) keyvalue=9; goto proecess9; if (keyvalue=0x14) keyvalue=10; goto proecess10; if (keyvalue=0x10) keyvalue=11; goto proecess11; if (keyvalue=0x1f) keyv

40、alue=12; goto proecess12; if (keyvalue=0x1e) keyvalue=13; goto proecess13; if (keyvalue=0x1c) keyvalue=14; goto proecess14; if (keyvalue=0x18) keyvalue=15; goto proecess15; proecess0: temp = port1000 ;/ /RES=0,reset lcd delay2(); port1000 = temp ;/ /RES=1,enable lcd Init_Lcd(); /initialize lcd Cls_L

41、cd();/清屏 delay2(); lcd_dsp(0,4,1,num0);/t return keyvalue; proecess1: temp = port1000 ;/ /RES=0,reset lcd delay2(); port1000 = temp ;/ /RES=1,enable lcd Init_Lcd(); /initialize lcd Cls_Lcd();/清屏 delay2(); lcd_dsp(0,4,1,num1);/t return keyvalue;proecess2: temp = port1000 ;/ /RES=0,reset lcd delay2();

42、 port1000 = temp ;/ /RES=1,enable lcd Init_Lcd(); /initialize lcd Cls_Lcd();/清屏 delay2(); lcd_dsp(0,4,1,num2);/t return keyvalue; proecess3: temp = port1000 ;/ /RES=0,reset lcd delay2(); port1000 = temp ;/ /RES=1,enable lcd Init_Lcd(); /initialize lcd Cls_Lcd();/清屏 delay2(); lcd_dsp(0,4,1,num3);/t r

43、eturn keyvalue; proecess4: temp = port1000 ;/ /RES=0,reset lcd delay2(); port1000 = temp ;/ /RES=1,enable lcd Init_Lcd(); /initialize lcd Cls_Lcd();/清屏 delay2(); lcd_dsp(0,4,1,num4);/t return keyvalue; proecess5: temp = port1000 ;/ /RES=0,reset lcd delay2(); port1000 = temp ;/ /RES=1,enable lcd Init

44、_Lcd(); /initialize lcd Cls_Lcd();/清屏 delay2(); lcd_dsp(0,4,1,num5);/t return keyvalue; proecess6: temp = port1000 ;/ /RES=0,reset lcd delay2(); port1000 = temp ;/ /RES=1,enable lcd Init_Lcd(); /initialize lcd Cls_Lcd();/清屏 delay2(); lcd_dsp(0,4,1,num6);/t return keyvalue; proecess7: temp = port1000

45、 ;/ /RES=0,reset lcd delay2(); port1000 = temp ;/ /RES=1,enable lcd Init_Lcd(); /initialize lcd Cls_Lcd();/清屏 delay2(); lcd_dsp(0,4,1,num7);/t return keyvalue; proecess8: temp = port1000 ;/ /RES=0,reset lcd delay2(); port1000 = temp ;/ /RES=1,enable lcd Init_Lcd(); /initialize lcd Cls_Lcd();/清屏 delay2(); lcd_dsp(0,4,1,num8);/t return keyvalue; proecess9: temp = port1000 ;/ /RES=0,reset lcd delay2(); port1000 = temp ;/ /RES=1,enable lcd Init_Lcd(); /initialize lcd Cls_Lcd();/清屏

溫馨提示

  • 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)論