EDA專業(yè)課程設(shè)計鍵盤掃描電路設(shè)計_第1頁
EDA專業(yè)課程設(shè)計鍵盤掃描電路設(shè)計_第2頁
EDA專業(yè)課程設(shè)計鍵盤掃描電路設(shè)計_第3頁
EDA專業(yè)課程設(shè)計鍵盤掃描電路設(shè)計_第4頁
EDA專業(yè)課程設(shè)計鍵盤掃描電路設(shè)計_第5頁
已閱讀5頁,還剩5頁未讀 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

電子課程設(shè)計—鍵盤掃描電路設(shè)計學(xué)院:班級:姓名:學(xué)號:指導(dǎo)老師:12月目錄1.設(shè)計任務(wù)和要求……………12.功效模塊……………………23.選擇器件……………………34.功效模塊……………………55.設(shè)計總體電路圖……………86.心得體會…………………10設(shè)計任務(wù)和要求1、鍵盤按鈕數(shù)為4,系統(tǒng)時鐘10MHz;2、能識別出所按按鈕;3、按鈕被按下后,視為此按鈕輸入一次,若按鈕長時間不松,(時限1S)后每隔0.5S視為再次輸入,直至按鈕松開;4、要求能對按鈕按下時指令抖動能正確處理。對連續(xù)時間小于50ms輸入不作響應(yīng);5、各鍵設(shè)置不一樣優(yōu)先級,多鍵同時按下時,視為優(yōu)先級較高按鍵被按下;功效模塊圖3模塊delta其VHDL語言以下:libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;useieee.std_logic_unsigned.all;entitykeyboard4_4isport(rst:instd_logic;clk_in:instd_logic;keyin:instd_logic_vector(3downto0);scan:outstd_logic_vector(3downto0);leds:outstd_logic_vector(3downto0); state : outstd_logic; VGA:outstd_logic_vector(3downto0));endkeyboard4_4;architecturekeyboard4_4_archofkeyboard4_4is----********************************************* componentdebouncing port( key :INSTD_LOGIC; clk,clr:INSTD_LOGIC; dly_out:OUTSTD_LOGIC); endcomponent;--*********************************************--signalclkfrq:std_logic;signalcntscn:std_logic_vector(1downto0);signalscnlin:std_logic_vector(3downto0);signalcntfrq:std_logic_vector(14downto0);--signalcntfrq:std_logic_vector(3downto0);signallednum:std_logic_vector(7downto0); signalkey_tmp : std_logic_vector(3downto0); signalclk : std_logic; signalcntfrq1:std_logic_vector(5downto0);begin VGA<="0101"; --鍵盤功效選擇 scan<=notscnlin; lednum<=scnlin&(notkey_tmp);-- key_tmp<=keyin;--debounuingcktdebounuing:blockbegin U1:debouncingPORTMAP( KEY=>keyin(0), DLY_OUT=>key_tmp(0), clr=>rst, clk=>CLK ); U2:debouncingPORTMAP( KEY=>keyin(1), dly_out=>key_tmp(1), clr=>rst, clk=>CLK ); U3:debouncingPORTMAP( key=>keyin(2), dly_out=>key_tmp(2), clr=>rst, clk=>CLK ); U4:debouncingPORTMAP( key=>keyin(3), dly_out=>key_tmp(3), clr=>rst, clk=>CLK );ENDblockdebounuing;----******************************************************--process(rst,clk_in)--晶振為40MHz,進行40000分頻產(chǎn)生去抖時鐘(1000Hz)beginifrst='0'thencntfrq<=(others=>'0');elsifrising_edge(clk_in)thenif(cntfrq="111"ornot(key_tmp="1110"orkey_tmp="1101"orkey_tmp="1011"orkey_tmp="0111"))then--if(cntfrq="111"orkey_tmp="1111")then--ifcntfrq="1111"thencntfrq<=(others=>'0');clk<=notclk;--去抖時鐘elsecntfrq<=cntfrq+1;endif;endif;endprocess; process(rst,clk) --去抖時鐘,50分頻,形成掃描時鐘 begin ifrst='0'then clkfrq<='0'; cntfrq1<=(others=>'0'); elsifrising_edge(clk)then ifcntfrq1="11000"then cntfrq1<=(others=>'0'); clkfrq<=notclkfrq; else cntfrq1<=cntfrq1+1; endif; endif; endprocess;process(rst,clkfrq)--依據(jù)掃描時鐘產(chǎn)生掃描線beginifrst='0'thencntscn<="00";elsifrising_edge(clkfrq)thenifcntscn="11"thencntscn<="00";elsecntscn<=cntscn+1;endif;casecntscniswhen"00"=>scnlin<="0001";when"01"=>scnlin<="0010";when"10"=>scnlin<="0100";when"11"=>scnlin<="1000";whenothers=>null;endcase;endif;endprocess;process(rst,clkfrq)--依據(jù)按鍵點亮對應(yīng)ledsbeginif(rst='0')thenleds<=not"1111";elsifclkfrq'eventandclkfrq='0'thencaselednumiswhen"00010001"=>leds<=not"0001"; --1when"00010010"=>leds<=not"0010"; --2when"00010100"=>leds<=not"0011"; --3when"00011000"=> leds<=not"1010"; --Awhen"00100001"=>leds<=not"0100"; --4when"00100010"=> leds<=not"0101"; --5when"00100100"=>leds<=not"0110"; --6 when"00101000"=>leds<=not"1011"; --Bwhen"01000001"=>leds<=not"0111"; --7when"01000010"=>leds<=not"1000"; --8when"01000100"=>leds<=not"1001"; --9when"01001000"=>leds<=not"1100"; --Cwhen"10000001"=>leds<=not"1110"; --*when"10000010"=>leds<=not"0000"; --0when"10000100"=>leds<=not"1111"; --#when"10001000"=>leds<=not"1101"; --D

溫馨提示

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

評論

0/150

提交評論