- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
DEBOUNCE.VHD
上传用户:dgjihui88
上传日期:2013-07-23
资源大小:43k
文件大小:1k
源码类别:
VHDL/FPGA/Verilog
开发平台:
MultiPlatform
- --debounce.vhd keypress debounce
- library ieee ;
- use ieee.std_logic_1164.all;
- use ieee.std_logic_unsigned.all;
- entity debounce is
- port(
- key_pressed : in std_logic;--key_pressed?
- clk : in std_logic;--clock for synchrony
- scan_f : in std_logic;--1khz clock
- key_valid : out std_logic);--key_valid?
- end debounce;
- architecture behavior of debounce is
- begin
- debounce:process(clk,scan_f,key_pressed)
- variable dbnq : std_logic_vector(5 downto 0);
- begin
- if (key_pressed='1') then
- dbnq:="111111";--unkey_pressed,counter reset at 63
- elsif (clk'event and clk='1') then
- if scan_f='1' then
- if dbnq/=1 then
- dbnq:=dbnq-1;--key_pressed not enough long time
- end if; --counter still subtract one
- end if;
- end if;
- if dbnq=2 then
- key_valid<='1';--key_valid after key_pressed 1/63k second
- else
- key_valid<='0';--key_invalid
- end if;
- end process;
- end behavior;