FPGA综合设计实例重点.ppt

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
第十章综合设计实例;1 键盘扫描与显示;以行扫描为例:;数码管显示;library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity key_scan is port(column:in std_logic_vector(3 downto 0); --列状态 scan_cnt:in std_logic_vector(3 downto 0);---扫描字 row:out std_logic_vector(3 downto 0);---行状态 key_pressed:out std_logic);-----按键有效与否,后续判断为零则为有键按下 end ; architecture rtl of key_scan is begin row=1110 when scan_cnt(3 downto 2)=00 else 1101 when scan_cnt(3 downto 2)=01 else 1011 when scan_cnt(3 downto 2)=10 else 0111; key_pressed=column(0) when scan_cnt(1 downto 0)=00 else column(1) when scan_cnt(1 downto 0)=01 else column(2) when scan_cnt(1 downto 0)=“10 else column(3); end rtl ; ;按键处理控制模块;按键消抖控制模块;debounce:process(clk,scan_clk,key_pressed) variable dbnq:std_logic_vector(5 downto 0); begin if(key_pressed=1)then dbnq:=111111;--unkey_pressed,count reset at 63 elsif(clkevent and clk=1)then if scan_clk=1 then if dbnq/=1 then dbnq:=dbnq-1;--key_pressed not enough long time end if; end if; end if; if dbnq=2 then key_valid=1;--key_valid after key_pressed 1/63k second else key_valid=0; end if; end process; end; ;键盘译码及按键存储模块;when0000=butt_code=0001;--1 when0001=butt_code=0010;--2 when0010=butt_code=0011;--3 when0011=butt_code=1100;--c when0100=butt_code=0100;--4 when0101=butt_code=0101;--5 when0110=butt_code=0110;--6 when0111=butt_code=1101;--d when1000=butt_code=0111;--7 when1001=butt_code=1000;--8 when1010=butt_code=1001;--9 when1011=butt_code=1110;--e when1100=butt_code=1010;--a when1101=butt_code=0000;--0 when1110=butt_code=1011;--b when others =butt_code=1111;--f end case; end if; end if; end process;end ;; 电锁控制模块;begin if data

文档评论(0)

***** + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档