EDA课程设计--键盘扫描电路设计_第1页
EDA课程设计--键盘扫描电路设计_第2页
EDA课程设计--键盘扫描电路设计_第3页
EDA课程设计--键盘扫描电路设计_第4页
EDA课程设计--键盘扫描电路设计_第5页
已阅读5页,还剩9页未读 继续免费阅读

付费下载

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、电子课程设计键盘扫描电路设计学院:班级:姓名:学号: 指导老师:2009年12月目录1. 设计任务与要求 12. 功能模块 23. 选择器件 34. 功能模块 55. 设计总体电路图 86. 心得体会 10设计任务与要求1、键盘按钮数为4,系统时钟10MHz2、能识别出所按按钮3、按钮被按下后,视为此按钮输入一次,若按钮长时间不松,(时限1S) 后每隔0.5S视为再次输入,直至按钮松开4、 要求能对按钮按下时指令的抖动能正确处理。对持续时间小于50ms 的输入不作响应;5、各键设置不同优先级,多键同时按下时,视为优先级较高的按键被按下;功能模块其VHDL语言如下:library ieee;us

2、e ieee.stdo gic_1164.all;use ieee.std_logic_ un sig ned.all;use ieee.std_logic_ un sig ned.all;en tity keyboard4_4 isport(rst : in stdo gic;clk_in : instdo gickeyi n :instd_logic_vector(3 downto 0);sca noutstdogic_vector(3 downto 0);leds :outstd_logic_vector(3 dow nto 0);state:out std_logic;VGA:out

3、std_logic_vector(3 dow nto 0);end keyboard4_4;architecture keyboard4_4_arch of keyboard4_4 is*comp onent debo uncingport( key : IN STD_LOGIC ;clk,clr : IN STD_LOGIC ;dly_out : OUT STD_LOGIC );end comp onent ;*sig nal clkfrqstd_logic;sig nal cn tsc nstdo gic_vector(1 dow nto 0);sig nal sen li nstdo g

4、ic_vector(3 dow nto 0);sig nal cntfrq :stdo gic_vector(14 dow nto 0);-sig nal cntfrq :stdo gic_vector(3 dow nto 0);sig nal led num : stdo gic_vector(7 dow nto 0);sig nal key_tmp :stdo gic_vector(3 dow nto 0);sig nal clk:std_logic;sig nal cn tfrq1: stdo gic_vector(5 dow nto 0);beg inVGA = 0101;-键盘功能选

5、择sca n = not sen li n;led num = sen li n & (not key_tmp);- key_tmp keyi n(0),DLY_OUT = key_tmp(0),clr=rst,clk = CLK);U2: debou ncing PORT MAP (KEY = keyi n(1),dly_out = key_tmp(1), clr=rst,clk = CLK);U3: debou ncing PORT MAP (key = keyi n(2),dly_out = key_tmp(2), clr=rst,clk = CLK);U4: debou ncing P

6、ORT MAP (key = keyi n(3),dly_out = key_tmp(3), clr=rst,clk = CLK);END block debo unuing ;*process(rst,clk_i n)-晶振为40MHz进行40000分频产生去抖时钟(1000Hz)beg inif rst = O the ncntfrq 0);elsif risin g_edge(clk_i n) the nif (cntfrq = 1111 or not (key_tmp=1110 orkey_tmp=1101 or key_tmp=1011 or key_tmp=0111) ) the

7、n-if (cntfrq = 1111 or key_tmp=1111 ) the n-if cntfrq = 1111 the ncntfrq 0);clk = n ot elk;-去抖时钟elsecntfrq = cntfrq + 1;end if;end if;end process;process(rst,clk)- 去抖时钟,50分频,形成扫描时钟begi nif rst = 0 the nclkfrq = 0;cn tfrq1 0);elsif risin g_edge(clk) the nif cntfrql = 11000 thencn tfrql 0);clkfrq = no

8、t clkfrq;elsecn tfrql = cn tfrql + 1;end if;end if;end process;process(rst,clkfrq)-根据扫描时钟产生扫描线beg inif rst = 0 the ncn tscn = 00;elsif risin g_edge(clkfrq) the nif cntscn = 11 the ncntscn = 00;elsecn tsc n senlin senlin senlin senlin n ull;end ease;end if;end process;process(rst, elkfrq)-根据按键点亮相应的le

9、dsbeg inif(rst = O ) thenleds leds leds leds leds leds leds leds leds leds leds leds leds leds leds -#-Dleds leds null;end case;end if;end process;process(rst,key_tmp)begi nif(rst = 0 ) the nstate = 1;elsif (key_tmp=1110 or key_tmp=1101 or key_tmp=1011 or key_tmp=0111) the nstate = 0;elsif (key_tmp=1111) the nstate = 1;end if;end process;end keyboard4_4_arch;三、心得体会经过两周的课程设计,由于是第一次,过程有点曲折,有点累,但最后能得 到理想的结果,心里感到特别高兴。因为是课程设计,需要制定一个最合理的方 案。这就锻炼了我们理论分析、比较,联系实际情况的能力。由于需要各个方面 的材料和数据,我们需要运用各种手段去查找资料,这增长了我们自学的能力

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论