摘 要:為了有效防止機械式鍵盤按鍵抖動帶來的數據錯誤,這里在Quartus Ⅱ開發環境下,采用VHDL語言設計了一種能夠將機械式4×4矩陣鍵盤的按鍵值依次顯示到8個7段數碼管上的矩陣鍵盤及顯示電路。仿真結果表明,所設計的矩陣鍵盤及顯示電路成功地實現了按鍵防抖和按鍵數據的準確顯示。以ACEX1K系列EP1K30QC208芯片為硬件環境,驗證了各項設計功能的正確性。關鍵詞:VHDL; 鍵盤; 按鍵防抖; 數碼管
中圖分類號:TN710-34; TP332.1+2 文獻標識碼:A 文章編號:1004-373X(2010)16-0014-03
Design of the Matrix Keyboard and Display Circuit Based on VHDL
ZHANG Xi-feng,QU Bao-peng
(Electronics Engineer Department of Shaanxi Institute of Technology, Xi’an 710300,China)
Abstract:The application of the FPGA/CPLD becomes more and more extensive in the design of digital system, and it has affected our life deeply. The data inputted by matrix keyboard and displayed by digital tube, the design is applied widely in electron equipments. In order to avoid the data mistakes resulted by the key-press shake, a matrix keyboard and display circuit which can display the key-press input data produced by 4×4 matrix keyboard in turn with 8 word 7-seg display was designed with the language of VHDL in the environment of Quartus Ⅱ. The simulation results indicate that the matrix keyboard and display circuit designed in this paper realized the key-press anti-shake and exact display. Finally, validity of whole designed functions was validated with the EP1K30QC208 chip of ACEX1K series.Keywords:VHDL; keyboard; anti-shake; digital tube
收稿日期:2010-03-12
FPGA/CPLD在數字系統設計中的廣泛應用,影響到了生產生活的各個方面[1-4]。在FPGA/CPLD的設計開發中,VHDL語言作為一種主流的硬件描述語言,具有設計效率高,可靠性好,易讀易懂等諸多優點[3,5-6]。作為一種功能強大的FPGA/CPLD數字系統開發環境,Altera公司推出的Quartus Ⅱ,為設計者提供了一種與結構無關的設計環境,使設計者能方便地進行設計輸入、快速處理和器件編程,為使用VHDL語言進行FPGA/CPLD設計提供了極大的便利[7]。
矩陣鍵盤作為一種常用的數據輸入設備,在各種電子設備上有著廣泛的應用,通過7段數碼管將按鍵數值進行顯示也是一種常用的數據顯示方式。在設計機械式矩陣鍵盤控制電路時,按鍵防抖和按鍵數據的譯碼顯示是兩個重要方面。
本文在Quartus Ⅱ開發環境下,采用VHDL語言設計了一種按鍵防抖并能連續記錄并顯示8次按鍵數值的矩陣鍵盤及顯示電路。
1 矩陣鍵盤及顯示電路設計思路
矩陣鍵盤及顯示電路能夠將機械式4×4矩陣鍵盤的按鍵值依次顯示到8個7段數碼管上,每次新的按鍵值顯示在最右端的第0號數碼管上,原有第0~6號數碼管顯示的數值整體左移到第1~7號數碼管上顯示,見圖1?!?br>