SCAN_COUNT.VHD
上传用户:dgjihui88
上传日期:2013-07-23
资源大小:43k
文件大小:1k
源码类别:
VHDL/FPGA/Verilog
开发平台:
MultiPlatform
- --scan_count.vhd scan keypress counter
- library ieee ;
- use ieee.std_logic_1164.all;
- use ieee.std_logic_arith.all;
- use ieee.std_logic_unsigned.all;
- entity scan_count is
- port(
- clk : in std_logic;--clock
- scan_f : in std_logic;--1khz clock
- key_pressed : in std_logic;--detect key_preeed to stop counter
- scan_cnt : out std_logic_vector(3 downto 0));--count
- end scan_count;
- architecture behavior of scan_count is
- signal qscan : std_logic_vector(3 downto 0);
- begin
- scan_1:process(clk,scan_f,key_pressed)
- begin
- if (clk'event and clk='1') then
- if(scan_f='1' and key_pressed='1') then
- qscan<=qscan+1;
- end if;
- end if;
- end process;
- scan_cnt<=qscan;
- end behavior;