【正文】
686 。generic (osc_f : integer := 100 。for testingport( clk : in std_logic。end fpq100to1。 osc_bit : integer := 12)。 osc_bit : integer := 7)。 clock scan_f : out std_logic。 1khzend fpq100to1。內(nèi)部反饋的實(shí)現(xiàn)方法是被設(shè)計(jì)實(shí)體的一個(gè)端口設(shè)定為緩沖模式,同時(shí)在該設(shè)計(jì)實(shí)體內(nèi)部建立內(nèi)部節(jié)點(diǎn)。設(shè)定為緩沖模式的端口信號(hào)驅(qū)動(dòng)源是來自被設(shè)計(jì)實(shí)體的內(nèi)部或者是來自其他實(shí)體設(shè)定為緩沖模式的端口。定義的端口程序是:entity smjsq isport(clk : in std_logic。1khz clock key_pressed : in std_logic。countend smjsq。定義的端口程序是:entity jiance isport( col : in std_logic_vector(3 downto 0)。keybord scan location row : out std_logic_vector(3 downto 0)。key_pressed0 unkey_pressed1end jiance。:在檢測(cè)到有按鍵按下的時(shí)候,這個(gè)過程中,被按到的按鍵必然會(huì)產(chǎn)生抖動(dòng),所以我們就要設(shè)計(jì)一個(gè)能消除按鍵抖動(dòng)的電路,消除不必要的誤差,按鍵抖動(dòng)消除電路實(shí)際上是一個(gè)倒數(shù)計(jì)數(shù)器電路。use 。use 。 key_pressed? clk : in std_logic。 1khz clock key_valid : out std_logic)。在按鍵抖動(dòng)消除電路中,key_pressed、clk和scan_f為輸入端口,只有一個(gè)輸出端口是key_valid。定義的端口程序是:library ieee。use 。entity bianma1 isport( scan_t : in std_logic_vector(3 downto 0)。 bianma : out std_logic_vector(3 downto 0))。以上程序是在鍵盤編碼電路中,scan_t、clk 和 key_valid為鍵盤編碼電路的輸入端口,bianma為按鍵編碼的輸出端口。event and clk=39。) then if (key_valid=39。) then case scan_t is encoding when 0000= bianma =0001。 2 when 0010= bianma =0011。 c when 0100= bianma =0100。 5 when 0110= bianma =0110。 d when 1000= bianma =0111。 8 when 1010= bianma =1001。 e when 1100= bianma =1010。 0 when 1110= bianma =1011。 f end case。:總結(jié)本次設(shè)計(jì)描述了基于VHDL的鍵盤掃描電路設(shè)計(jì),主要是利用VHDL硬件描述語言,在MAX+PLUSⅡ設(shè)計(jì)平臺(tái)下進(jìn)行設(shè)計(jì)、編程、查找錯(cuò)誤、進(jìn)行修改,直到最后的仿真通過。通過基于VHDL的鍵盤掃描電路設(shè)計(jì),不但收獲了新的知識(shí),并且多學(xué)了一門編程語言,同時(shí)還鞏固了原來都差不多忘記的知識(shí),總體來說收獲還是很大的,在設(shè)計(jì)期間,遇到了很多問題,有一段時(shí)間都做不下去了,就放下了一段時(shí)間沒有動(dòng)過,導(dǎo)致的是越來越不想做了,后來在指導(dǎo)老師馮老師的鼓勵(lì)下,又重新拿起了這次的畢業(yè)設(shè)計(jì),老師不斷的鼓勵(lì)是我前進(jìn)的動(dòng)力,我每天都在堅(jiān)持著做一點(diǎn)再做一點(diǎn),在期間也遇到了很多的困難,開始還很笨拙,老師說新手怎么可能不出錯(cuò),就這樣堅(jiān)持著,后來就慢慢的熟練了很多,再后來就沒當(dāng)初的那么難了,在指導(dǎo)老師馮老師的幫助下最后終于順利的完成了這次的畢業(yè)設(shè)計(jì)。致謝在整個(gè)設(shè)計(jì)的過程中,最應(yīng)該感謝的是我的指導(dǎo)老師馮老師給了我很大的幫助,感謝她對(duì)我的耐心教導(dǎo)和細(xì)心的照顧。沒有馮老師的辛勤栽培、孜孜教誨,就沒有我論文的順利完成。在整個(gè)論文設(shè)計(jì)的過程中,還應(yīng)該謝謝我的同學(xué)對(duì)我的幫助,以及那些給過我?guī)椭娜?,我在這里表示最真誠的感謝。北京交通大學(xué)出版社,[10][M].北京:中國勞動(dòng)社會(huì)保障出版社,2007.[11]胡振華. VHDL與FPGA設(shè)計(jì)[M].北京:中國鐵道出版社,[12](第五版)[M]. 北京:高等教育出版社,.[13][M].北京:機(jī)械工業(yè)出版社,[14]Michael Petronino,Ray Bambha,James Carswell,and Wayne Bvrleson. ANFPGABASED DATA ACQUISITION SYSTEM FOR A, 95 GHZ WBAND of Electrical and Computer Engineering MA 01003:41054108[15]+PLUSⅡ入門與提高[M]. 北京:.[16]張丕狀,[M].北京:國防工業(yè)出版社,2009:216.[17] Petterson, Michael A. MATRIX KEYBOARD ENCODER CIRCUIT.[18]Michael Petronino,Ray Bambha,James Carswell,and Wayne Bvrleson. ANFPGABASED DATA ACQUISITION SYSTEM FOR A, 95 GHZ WBAND of Electrical and Computer Engineering MA 01003:41054108附錄分頻器電路的程序library ieee。use 。 osc_bit : integer := 12)。 osc_bit : integer := 7)。 clock scan_f : out std_logic。 1khzend fpq100to1。event and clk=39。)then if q=99 then q = q + 1 。 end if。 end if。scan_f =39。 when q=1100100。鍵盤掃描計(jì)數(shù)器電路的程序library ieee。use 。entity smjsq isport(clk : in std_logic。1khz clock key_pressed : in std_logic。countend smjsq。begin scan_1:process(clk,scan_f,key_pressed )begin if (clk39。139。139。139。 end if。 end process。end behavior。use 。use 。keybord column state scan_t : in std_logic_vector(3 downto 0)。keybord row state key_pressed : out std_logic)。architecture behavior of jiance isbeginrow ecoding row = 1110 when scan_t(3 downto 2) = 00 else 1101 when scan_t(3 downto 2) = 01 else 1011 when scan_t(3 downto 2) = 10 else 0111。end behavior。use 。entity xiaodou isport( key_pressed : in std_logic。 clock for synchrony scan_f : in std_logic。key_valid?end xiaodou。 begin if (key_pressed=39。) then dbnq:=111111。event and clk=39。) then if scan_f =39。 then if dbnq/=1 then dbnq:=dbnq1。 counter still subtract one end if。 if dbnq=2 then key_valid=39。key_valid after key_pressed 1/63k second else key_valid=39。key_invalid end if。 end behavior。use 。use 。keybord scan count clk , key_valid : in std_logic。button codeend bianma1。event and clk=39。) then if (key_valid=39。) then case scan_t is encoding when 0000= bianma =0001。 2 when 0010= bianma =0011。 c when 0100= bianma =0100。 5 when 0110= bianma =0110。 d when 1000= bianma =0111。 8 when 1010= bianma =1001。 e when 1100= bianma =1010。 0 when 1110= bianma =1011。 f end case。end if。end behavior。use 。use 。 osc_bit : integer := 7)。 col : in std_logic_vector(3 downto 0)。 key_pressed : in std_logic。 1khz clock scan_t : in std_logic_vector(3 downto 0)。 row , bianma : out std_logic_vector(3 downto 0))。 END saomiaodian。signal key_pressed : std_logic。signal key_valid : std_logic。 clock scan_f : out std_logic。 END ponent。 scan_f : in std_logic。 scan_t : out std_logic_vector(3 downto 0))。ponent jiancePORT( col : in std_logic_vector(3 downto 0)。 row : out std_logic_vector(3 downto 0)。END ponent。 key_pressed? clk : in std_logic。 1khz clock key_valid : out std_logic)。ponent bianma1port( scan_t : in std_logic_vector(3 downto 0)。 bianma : out std_logic_vector(3 downto 0))。BEGINU1:fpq100to1 port map (clk , scan_f)。U3:jiance port map (col , scan_t , row , key_pressed )。U5:bianma1 port map (scan_t , clk , key_valid , bianma )。