課程設(shè)計(jì)基于FPGA的VGA圖像漢字顯示及_PS_2鍵盤(pán)控制設(shè)計(jì)與應(yīng)用.doc_第1頁(yè)
課程設(shè)計(jì)基于FPGA的VGA圖像漢字顯示及_PS_2鍵盤(pán)控制設(shè)計(jì)與應(yīng)用.doc_第2頁(yè)
課程設(shè)計(jì)基于FPGA的VGA圖像漢字顯示及_PS_2鍵盤(pán)控制設(shè)計(jì)與應(yīng)用.doc_第3頁(yè)
課程設(shè)計(jì)基于FPGA的VGA圖像漢字顯示及_PS_2鍵盤(pán)控制設(shè)計(jì)與應(yīng)用.doc_第4頁(yè)
課程設(shè)計(jì)基于FPGA的VGA圖像漢字顯示及_PS_2鍵盤(pán)控制設(shè)計(jì)與應(yīng)用.doc_第5頁(yè)
已閱讀5頁(yè),還剩11頁(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)介

電子信息工程專業(yè)綜合設(shè)計(jì)(報(bào)告)(課 程 設(shè) 計(jì))題目 基于fpga的vga圖像漢字顯示及ps/2鍵盤(pán)控制設(shè)計(jì)與應(yīng)用 二級(jí)學(xué)院 專 業(yè) 班 級(jí) 學(xué)生姓名 學(xué) 號(hào) 指導(dǎo)教師 時(shí) 間 基于fpga的vga圖像漢字顯示及ps/2鍵盤(pán)控制設(shè)計(jì)與應(yīng)用摘 要:現(xiàn)在社會(huì),以計(jì)算機(jī)技術(shù)為核心的信息技術(shù)迅速發(fā)展,以及信息的爆炸式增長(zhǎng),人類獲得視覺(jué)信息的很大一部分是從各種各樣的電子顯示器件上獲得的,對(duì)這些電子顯示器件的要求也越來(lái)越高,在這些諸多因素的驅(qū)動(dòng)下,顯示技術(shù)也取得了飛速的發(fā)展。vga(video graphics array)是ibm在1987年隨ps2機(jī)一起推出的一種視頻傳輸標(biāo)準(zhǔn),具有分辨率高、顯示速率快、顏色豐富等優(yōu)點(diǎn),在彩色顯示器領(lǐng)域得到了廣泛的應(yīng)用。使用fpga設(shè)計(jì)的vga顯示控制器具有很高的靈活性,可以根據(jù)其不同的類型、尺寸、適用場(chǎng)合特別是不同的工業(yè)產(chǎn)品,做一些特殊的設(shè)計(jì),以最小的代價(jià)滿足系統(tǒng)的要求,而且可以解決通用的顯示控制器本身固有的一些缺點(diǎn)。vga(視頻圖形陣列)作為一種標(biāo)準(zhǔn)的顯示接口得到廣泛的應(yīng)用。本文依據(jù)vga顯示原理,介紹了利用 fpga 實(shí)現(xiàn)對(duì)vga圖形控制器vhdl設(shè)計(jì)及ps/2鍵盤(pán)與按鍵對(duì)顯示圖象控制的方法。詳細(xì)描述了各硬件模塊的工作原理及實(shí)現(xiàn)途徑,并給出了軟件設(shè)計(jì)思路及部分代碼。 關(guān)鍵詞:vga;fpga;vhdl;ps/20. 引言 隨著可編程邏輯器件的不斷發(fā)展及其價(jià)格的不斷下降,eda 開(kāi)發(fā)軟件的不斷完善,可編程邏輯設(shè)計(jì)的應(yīng)用優(yōu)勢(shì)逐漸顯示出來(lái), 特別是大規(guī)??删幊唐骷?而 fpga 具有功能強(qiáng)大,開(kāi)發(fā)過(guò)程投資小、周期短等特點(diǎn),成為當(dāng)今硬件設(shè)計(jì)的首選方式之一。vga(視頻圖形陣列)作為一種標(biāo)準(zhǔn)的顯示接口得到廣泛地應(yīng)用。利用 fpga 芯片和 eda設(shè)計(jì)方法,可以靈活地根據(jù)用戶需求,設(shè)計(jì)出針對(duì)性強(qiáng)的 vga 顯示控制器,不僅降低了生產(chǎn)成本也可以快速地對(duì)產(chǎn)品進(jìn)行升級(jí)換代。 本文設(shè)計(jì)采用 quartus ii 9.0軟件工具,并以 altera公司的 cyclone 系列 fpga 的器件ep1c12f324c8為主實(shí)現(xiàn)硬件平臺(tái)的設(shè)計(jì)。1 方案設(shè)計(jì)及工作原理 1.1 vga模塊方案設(shè)計(jì) 采用模塊化設(shè)計(jì)方法,我們對(duì) vga 圖形控制器按功能進(jìn)行層次劃分。本設(shè)計(jì)的vga控制器主要由以下模塊組成:vga 時(shí)序控制模塊、rom 內(nèi)存地址控制模塊、rom內(nèi)存模塊、按鍵掃描控制模塊。如圖 1 所示。 圖1.方案模塊框圖1.2工作原理 vga時(shí)序控制 模塊 rom內(nèi)存地址控制模塊 rom 按鍵掃描 控制模塊 50mhz 5hz addr data 首坐標(biāo)xx、yy vga 接口 rgb hs、vs d/a crt 根據(jù)vga的顯示協(xié)議,可以選擇不同的顯示分辨率。本設(shè)計(jì)選擇的是800*600的分辨率。根據(jù)相應(yīng)協(xié)議,在“vga時(shí)序控制模塊”對(duì)行掃描信號(hào)hs和場(chǎng)掃描信號(hào)vs進(jìn)行相應(yīng)的時(shí)序控制(具體控制詳細(xì)信息見(jiàn)“vga驅(qū)動(dòng)原理”資料文檔)。 “rom內(nèi)存地址控制模塊”根據(jù)“按鍵掃描控制模塊”獲得的圖片顯示首坐標(biāo)xx、yy信息和“vga時(shí)序控制模塊”傳送過(guò)來(lái)的hcnt(列計(jì)數(shù)器值)、vcnt(行計(jì)數(shù)器值)及相關(guān)控制信號(hào)計(jì)算出正確的內(nèi)存地址,從rom中取出所需要的像素點(diǎn)的三基色數(shù)據(jù)。1.3 ps/2接口電路的工作原理ps/2協(xié)議和接口最初是ibm公司開(kāi)發(fā)并推廣使用的一種應(yīng)用于鍵盤(pán)/鼠標(biāo)的協(xié)議和接口,ps/2鍵盤(pán)按鍵接口是6芯的插頭與pc機(jī)的鍵盤(pán)相連接,插頭、插座定義如圖所示。鍵盤(pán)/鼠標(biāo)接口的數(shù)據(jù)線和時(shí)鐘線采用集電極開(kāi)路結(jié)構(gòu),平時(shí)都是高電平當(dāng)這些設(shè)備等待發(fā)送數(shù)據(jù)時(shí),它首先檢查clock是否為高。如果為低,則認(rèn)為pc抑制了通訊,此時(shí)它緩沖數(shù)據(jù)直到獲得總線的控制權(quán)。如果clock為高電平,設(shè)備則開(kāi)始向pc發(fā)送數(shù)據(jù)。一般都是由ps2設(shè)備產(chǎn)生時(shí)鐘信號(hào)。發(fā)送按幀格式。數(shù)據(jù)位在clock為高電平時(shí)準(zhǔn)備好,在clock下降沿被pc讀入。圖3所示是按下q鍵的時(shí)序圖“q”鍵的掃描碼從鍵盤(pán)發(fā)送到計(jì)算機(jī)(通道a是時(shí)鐘信號(hào),通道b是數(shù)據(jù)信號(hào))。因本設(shè)計(jì)只需進(jìn)行控制,所以ps/2模塊并未設(shè)計(jì)轉(zhuǎn)碼功能。2 模塊設(shè)計(jì)及仿真 2.1 vga顯示模塊 圖片想要在顯示器上顯示出來(lái),它主要需要5個(gè)信號(hào),行同步信號(hào)(hs)、場(chǎng)同步信號(hào)(vs)和rgb三基色信號(hào)。vga時(shí)序控制模塊是須嚴(yán)格按照vga時(shí)序標(biāo)準(zhǔn)產(chǎn)生相應(yīng)的脈沖信號(hào)。對(duì)這5個(gè)信號(hào)的時(shí)序驅(qū)動(dòng),vga顯示器要嚴(yán)格遵守“vga工業(yè)標(biāo)準(zhǔn)”,即640*480*60hz模式,否則會(huì)損壞vga顯示器。vga工業(yè)標(biāo)準(zhǔn)要求的頻率是:時(shí)鐘頻率為25.175mhz,行頻為31469hz,場(chǎng)頻為59.94hz。圖為行hs、場(chǎng)vs時(shí)序圖圖 行hs、場(chǎng)vs時(shí)序圖顯示模塊是整個(gè)顯示控制器的重要組成部分,各個(gè)模塊的輸出數(shù)據(jù)都要經(jīng)過(guò)模塊處理后送到顯示器。顯示模塊在vga顯示控制器中起至關(guān)重要的作用。顯示模塊的輸出信號(hào)通過(guò)d/a轉(zhuǎn)換器的轉(zhuǎn)換連到vga接口,它是控制器和顯示器進(jìn)行通信的橋梁。該模塊以可以vhdl語(yǔ)言實(shí)現(xiàn)。2.2 rom內(nèi)存地址控制模塊 整個(gè)顯示思路是在640*480分辨率的顯示器上開(kāi)辟一128*128的顯示區(qū)域來(lái) 顯示圖片,因?yàn)轱@示的圖片的大小為128*128。在此區(qū)域以外顯示指定顏色,例如黑色、藍(lán)色等,作為一個(gè)背景色顯示。在本模塊中,通過(guò)在對(duì)rom內(nèi)存地址的控制,實(shí)現(xiàn)了圖片顯示功能。以下通過(guò)一段關(guān)鍵代碼詳細(xì)講解其實(shí)現(xiàn)原理。2.2.1romaddr_control的計(jì)算原理:romaddr_control o:=o+1;j:=0;-w when x01b = o:=d-1;j:=0;-s when x01c = o:=0;j:=j-1;-a when x023 = o:=0;j:=j+1;-d (其中o為圖片縱坐標(biāo)控制變量,j為橫坐標(biāo)控制變量)即可完成wasd對(duì)圖片移動(dòng)的控制。對(duì)應(yīng)操作為:w:圖片上移。s:圖片下移。a:圖片右移。d:圖片左移。2.4 按鍵控制模塊 按鍵控制采用的電平觸發(fā)機(jī)制,1hz左右的掃描頻率,適合于人們的使用習(xí)慣。其中按鍵的功能里包括了:a.上下、左右的移動(dòng);b.移動(dòng)中的加速減速停止啟動(dòng);c.屏保模式自由移動(dòng)和停止選擇按鈕。具體語(yǔ)句為if(clkmevent and clkm=1) then if(key1=0)then d:=d+1;e:=e+1;end if; if(key2=0)then d:=d-1;e:=e-1;end if; if(key3=0)then d:=d+1;e:=0;end if; if(key4=0)then d:=0;e:=e+1;end if;(其中d為圖片縱坐標(biāo)控制變量,e為橫坐標(biāo)控制變量)即可完成由開(kāi)發(fā)板上的s1s4按鍵對(duì)圖片的控制。對(duì)應(yīng)操作為:key1(s1):圖片自動(dòng)移動(dòng)開(kāi)始與加速。key2(s2):圖片自動(dòng)移動(dòng)減速與停止。key3(s3):圖片左移與加速。key4(s4):圖片右移與加速。2.5.漢字顯示模塊 本模塊實(shí)現(xiàn)方法為對(duì)特定區(qū)域進(jìn)行黑白兩色點(diǎn)陣顯示漢字。顯示區(qū)域?yàn)槠聊?4*16。點(diǎn)陣數(shù)據(jù)程序直接編寫(xiě),不額外添加rom存儲(chǔ)。 本模塊設(shè)置了兩個(gè)變量對(duì)顯示區(qū)域橫縱軸進(jìn)行函數(shù)運(yùn)算。即line1,pixel :integer range 0 to 15;3結(jié)果分析和調(diào)試 因?yàn)槟K較多,調(diào)試過(guò)程中出現(xiàn)中出現(xiàn)了不少問(wèn)題。1、 按預(yù)想情況,圖片在觸及屏幕邊沿是反彈,實(shí)際情況是直接消失,一段時(shí)間后重新出現(xiàn)在初始位置開(kāi)始運(yùn)動(dòng)。在進(jìn)行思考測(cè)試后,發(fā)現(xiàn)是原來(lái)的由hitcase代表圖片撞擊屏幕位置,然后編寫(xiě)case語(yǔ)句對(duì)xy進(jìn)行改變的運(yùn)算有所欠缺且十分復(fù)雜,難以尋找錯(cuò)誤。后改用對(duì)圖片坐標(biāo)判斷,然后進(jìn)行xy運(yùn)算后功能正常,同時(shí)使得程序更加簡(jiǎn)單易讀。2、 在測(cè)試圖片顯示的過(guò)程中,由于對(duì)vga顯示原理沒(méi)有完全理解。出現(xiàn)了圖片顯示紊亂的錯(cuò)誤。在對(duì)行場(chǎng)時(shí)序掃描部分查閱資料后,對(duì)程序語(yǔ)句進(jìn)行了重新編寫(xiě)后,圖片即顯示正常。3、 編寫(xiě)程序時(shí),出現(xiàn)過(guò)模塊無(wú)效的錯(cuò)誤。檢查后發(fā)現(xiàn)為自己對(duì)模塊調(diào)用方法的陌生。查閱資料后在程序中加入了中間量進(jìn)行中轉(zhuǎn)后,實(shí)現(xiàn)了模塊間的調(diào)用連接。4、 測(cè)試中,出現(xiàn)過(guò)鍵盤(pán)無(wú)法正常識(shí)別彈起狀態(tài)的錯(cuò)誤。后檢查發(fā)現(xiàn)并沒(méi)有編寫(xiě)彈起標(biāo)志位,加入flag變量與通碼一起進(jìn)行運(yùn)算后成功解決。經(jīng)過(guò)多次調(diào)試以及同學(xué)、老師的幫助下,解決了上訴遇到的問(wèn)題 ,由于時(shí)間有限 ,實(shí)現(xiàn)初步功能,沒(méi)有達(dá)到完美效果,基本符合本次設(shè)計(jì)要求。4體會(huì)與感受 在為期三周的課程設(shè)計(jì)中,進(jìn)一步鞏固了曾經(jīng)所學(xué)的eda相關(guān)知識(shí),并且第一次了解學(xué)習(xí)了vga相關(guān)原理。經(jīng)過(guò)本次課程設(shè)計(jì),對(duì)vhdl語(yǔ)言有了更進(jìn)一步了解,也豐富了一個(gè)電子信息工程學(xué)生的專業(yè)知識(shí),鍛煉了動(dòng)手能力和思辨能力 。此次課程設(shè)計(jì)師對(duì)我們理論的一次大檢驗(yàn)也是理論運(yùn)用與實(shí)際的完美展現(xiàn)。5. 參考文獻(xiàn)1 侯伯亨.vhdl硬件描述語(yǔ)言與數(shù)字邏輯電路設(shè)計(jì)m.西安:西安 電子科技大學(xué) 出版社,1999. 2 李國(guó)洪、沈明山??删幊唐骷da技術(shù)與實(shí)踐 機(jī)械工業(yè)出版社,20043 趙世霞、楊豐、劉揭生。 vhdl與微機(jī)接口設(shè)計(jì) 北京:清華大學(xué)出版社 2004 4 林敏.vhdl數(shù)字系統(tǒng)設(shè)計(jì)與高層次綜合m.北京:電子工業(yè)出版社,2001. 5 盧毅.vhdl與數(shù)字電路設(shè)計(jì)m.北京:科學(xué)出版社,2001. 6 張琴.向先波.徐國(guó)率 ps/2鍵盤(pán)在基于pic單片機(jī)的遠(yuǎn)程多溫度點(diǎn)巡檢系統(tǒng)中的應(yīng) 用 期刊論文 -機(jī)械與電子2006(08) 7 苗新法.王秀隼 ps/2鍵盤(pán)在嵌入式系統(tǒng)中的應(yīng)用研究 期刊論文 -蘭州交通大學(xué)學(xué) 報(bào)2007(01) 8 徐曉.汪道輝 標(biāo)準(zhǔn)ps/2鍵盤(pán)與單片機(jī)的接口設(shè)計(jì) 期刊論文 -中國(guó)測(cè)試技術(shù) 2005(01) 9、 鄭煒.須文波.胡晉 單片機(jī)系統(tǒng)中ps/2鍵盤(pán)驅(qū)動(dòng)程序設(shè)計(jì) 期刊論文 -單片機(jī)與嵌 入式系統(tǒng)200510 北京理工大學(xué)asic研究所,vhdl語(yǔ)言100例詳解,清華大學(xué)出版社 ,北京,1999 :302-310 11 altera 公司 ,datasheet of ep1k30,美國(guó),1999:401006 附錄(程序、元件清單和制作效果)1、頂層文件img.vhdlibrary ieee; -圖象顯示頂層程序 use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all;entity img is port ( clk50mhz ,clk1,clk2,data: in std_logic; key1,key2,key3,key4: in std_logic;hs, vs : out std_logic;r,g: out std_logic;b: out std_logic); end img; architecture modelstru of img is component vga640480 -vga顯示控制模塊 port(clk : in std_logic; rgbin ,rgbin1: in std_logic_vector(2 downto 0); hs, vs : out std_logic;r, g, b: out std_logic;hcntout, vcntout : out std_logic_vector(9 downto 0) ); end component;component keyboard -vga顯示控制模塊 port ( clk: in std_logic; -系統(tǒng)時(shí)鐘輸入 kb_clk: in std_logic; -ps/2鍵盤(pán)時(shí)鐘輸入 kb_data: in std_logic; -ps/2鍵盤(pán)數(shù)據(jù)輸入 keycode: out std_logic_vector(7 downto 0); -ps/鍵盤(pán)鍵值輸出 flag: out std_logic ); end component;component imgrom -圖象數(shù)據(jù)rom,數(shù)據(jù)線12位;地址線14位 port(clock : in std_logic; address : in std_logic_vector(13 downto 0); q : out std_logic_vector(2 downto 0) ); end component;component rom2 -圖象數(shù)據(jù)rom,數(shù)據(jù)線12位;地址線14位 port(clock : in std_logic; address : in std_logic_vector(13 downto 0); q : out std_logic_vector(2 downto 0) ); end component;component mid1port ( clk : in std_logic;qin1 : in std_logic_vector(2 downto 0);xx: in std_logic_vector(8 downto 0);yy: in std_logic_vector(8 downto 0); hcntin : in std_logic_vector(9 downto 0); vcntin : in std_logic_vector(9 downto 0);qout : out std_logic_vector(2 downto 0);romaddr_control : out std_logic_vector(13 downto 0); end component;component midport ( clk : in std_logic;qin : in std_logic_vector(2 downto 0);key1,key2,key3,key4: in std_logic;hcntin : in std_logic_vector(9 downto 0); vcntin : in std_logic_vector(9 downto 0);qout : out std_logic_vector(2 downto 0);code:in std_logic_vector(7 downto 0);flag:in std_logic;romaddr_control : out std_logic_vector(13 downto 0); end component; signal rgb : std_logic_vector(2 downto 0); signal rgb1 : std_logic_vector(2 downto 0); signal rgb2 : std_logic_vector(2 downto 0); signal rgb3 : std_logic_vector(2 downto 0); signal clk25mhz : std_logic; signal clk1hz : std_logic; signal romaddr : std_logic_vector(13 downto 0);signal romaddr1 : std_logic_vector(13 downto 0); signal romaddr2 : std_logic_vector(13 downto 0); signal hpos, vpos : std_logic_vector(9 downto 0);signal txx :std_logic_vector(8 downto 0);signal tyy :std_logic_vector(8 downto 0);signal code1:std_logic_vector(7 downto 0);signal flag1: std_logic;begin process(clk50mhz) begin if clk50mhzevent and clk50mhz = 1 then clk25mhz clk25mhz, rgbin = rgb1, rgbin1 = rgb3,hs = hs, vs = vs, r=r, g=g, b=b, hcntout = hpos, vcntout = vpos); i_rom2: rom2 port map(clock = clk25mhz, address = romaddr1, q =rgb2); i_rom : imgrom port map(clock = clk25mhz, address = romaddr, q = rgb); i_mid : mid port map(clk = clk25mhz, qin = rgb, hcntin = hpos, vcntin = vpos, qout =rgb1,romaddr_control = romaddr,code=code1,flag=flag1,key1=key1,key2=key2,key3=key3,key4=key4); i_mid1 : mid1 port map(clk = clk25mhz, xx = txx, yy= tyy ,qin1 = rgb2, hcntin = hpos, vcntin = vpos, qout =rgb3,romaddr_control = romaddr1); i_keyboard :keyboard port map(clk=clk50mhz,kb_clk=clk2, kb_data=data,keycode=code1,flag=flag1);end;2、vga顯示模塊library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity vga640480 is port ( clk : in std_logic; hs : out std_logic; vs : out std_logic; r : out std_logic; g : out std_logic; b : out std_logic; rgbin,rgbin1: in std_logic_vector(2 downto 0); hcntout : out std_logic_vector(9 downto 0); vcntout : out std_logic_vector(9 downto 0) ); end vga640480; architecture one of vga640480 is signal hcnt : std_logic_vector(9 downto 0); signal vcnt : std_logic_vector(9 downto 0); begin - assign pin hcntout = hcnt; vcntout = vcnt; -this is horizonal counter process(clk) begin if (rising_edge(clk) then if(hcnt 800) then hcnt = hcnt + 1; else hcnt 0); end if; end if; end process; -this is vertical counter process(clk) begin if (rising_edge(clk) then if (hcnt = 640+8 ) then if(vcnt 525) then vcnt = vcnt + 1; else vcnt 0); end if; end if; end if; end process; -this is hs pulse process(clk) begin if (rising_edge(clk) then if(hcnt= 640+8+8) and (hcnt640+8+8+96 ) then hs = 0; else hs = 480+8+2) and (vcnt 480+8+2+2) then vs = 0; else vs = 1; end if; end process; process(clk) begin if (rising_edge(clk) then if(hcnt=640 and vcnt=480)thenr=rgbin(2)or rgbin1(2);g=rgbin(1)or rgbin1(1);b=rgbin(0)or rgbin1(0);elser=0; g=0; b=0; end if; end if;end process;end one;3、rom地址及圖片運(yùn)動(dòng)控制模塊library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; entity mid is port (clk : in std_logic;key1,key2,key3,key4: in std_logic;qin : in std_logic_vector(2 downto 0); -xx: in std_logic_vector(9 downto 0); -yy: in std_logic_vector(8 downto 0);hcntin : in std_logic_vector(9 downto 0); vcntin : in std_logic_vector(9 downto 0);qout : out std_logic_vector(2 downto 0);code:in std_logic_vector(7 downto 0);flag:in std_logic;romaddr_control : out std_logic_vector(13 downto 0); end mid;architecture one of mid issignal hcnt : std_logic_vector(9 downto 0); signal vcnt : std_logic_vector(9 downto 0); signal qout_temp : std_logic_vector(2 downto 0);- signal romaddr_temp : std_logic_vector(13 downto 0);signal count_temph : std_logic_vector(9 downto 0);signal count_tempv : std_logic_vector(9 downto 0);signalclk_count: std_logic_vector(24 downto 0);signal tx: std_logic_vector(9 downto 0);signal ty: std_logic_vector(8 downto 0);signal m,t: std_logic ;signalclkm:std_logic;-signal tempxx: integer range 0 to 640;-signal tempyy: integer range 0 to 480;constant wide: integer:=128;constant long: integer:=128;begin- assign pin hcnt = hcntin; vcnt = vcntin;qout = qout_temp;romaddr_control = (vcnt(6 downto 0)-count_tempv(6 downto 0) & (hcnt(6 downto 0)-count_temph(6 downto 0); process(clk) begin if (rising_edge(clk) thenif(vcnt = ty) and( hcnt=tx ) )then count_temph=hcnt;count_tempv=vcnt; end if;if(vcnt ty+long) then qout_temptx)and (hcnttx + wide ) then -qout_temp=qin;-input logo.hexelseqout_temptx) and (hcntty-1)and (vcnt ty+long-1 ) and ( vcnt ty+long+2 ) ) then qout_tempty)and ( vcnt tx-1)and (hcnttx + wide-2 )and (hcnttx + wide+1 ) then qout_temp=100; end if;end if; -end if; end process;div: process(clk)beginif (clkevent and clk=1) thenif(clk_count 1100110111111110011000000)thenclk_count = clk_count + 1;clkm = 0;elseclk_count =0000000000000000000000001;clkm o:=o+1;j:=0;-w 119 when x01b = o:=d-1;j:=0;-s 115 when x01c = o:=0;j:=j-1;-a 973 when x023 = o:=0;j:=j+1;-d 100 when others = null; end case; end if; if(clkmevent and clkm=1) then if(key1=0)then d:=d+1;e:=e+1;end if; if(key2=0)then d:=d-1;e:=e-1;end if; if(key3=0)then d:=d+1;e:=0;end if; if(key4=0)then d:=0;e:=e+1;end if;end if;if (rising_edge(clk) then z:=z+1;if(z=111110) then z:=0; if(m=0)then y:=y+d; else y:=y-d; end if; if(t=640-wide)then t=1; end if; if(x=1) then t=480-long)then m=1; end if; if(y=1) then m=0;end if; end if; end if; tx=x; ty=y;end process; end one;4、鍵盤(pán)控制模塊library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;-entity keyboard isport ( clk: in std_logic; -系統(tǒng)時(shí)鐘輸入 kb_clk: in std_logic; -ps/2鍵盤(pán)時(shí)鐘輸入 kb_data: in std_logic; -ps/2鍵盤(pán)數(shù)據(jù)輸入 keycode: out std_logic_vector(7 downto 0);-ps/鍵盤(pán)鍵值輸出 flag: out std_logic ); end keyboard;-architecture behave of keyboard is signal dataerror :std_logic; -數(shù)據(jù)幀出錯(cuò)信號(hào) signal shiftdata :st

溫馨提示

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