收藏 分销(赏)

EDA专业课程设计键盘扫描电路设计.doc

上传人:精*** 文档编号:2864466 上传时间:2024-06-07 格式:DOC 页数:10 大小:62.54KB
下载 相关 举报
EDA专业课程设计键盘扫描电路设计.doc_第1页
第1页 / 共10页
EDA专业课程设计键盘扫描电路设计.doc_第2页
第2页 / 共10页
EDA专业课程设计键盘扫描电路设计.doc_第3页
第3页 / 共10页
EDA专业课程设计键盘扫描电路设计.doc_第4页
第4页 / 共10页
EDA专业课程设计键盘扫描电路设计.doc_第5页
第5页 / 共10页
点击查看更多>>
资源描述

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

2、brary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_unsigned.all;entity keyboard4_4 is port( rst : in std_logic; clk_in : in std_logic; keyin : in std_logic_vector(3 downto 0); scan : out std_logic_vector(3 downto 0); leds : out std_logic_vector(3 downto 0);stat

3、e: out std_logic;VGA : out std_logic_vector(3 downto 0) );end keyboard4_4;architecture keyboard4_4_arch of keyboard4_4 is-*component debouncingport(key : IN STD_LOGIC ; clk,clr : IN STD_LOGIC ; dly_out : OUT STD_LOGIC ) ;end component ;-*- signal clkfrq : std_logic; signal cntscn : std_logic_vector(

4、1 downto 0); signal scnlin : std_logic_vector(3 downto 0); signal cntfrq : std_logic_vector(14 downto 0); -signal cntfrq : std_logic_vector(3 downto 0); signal lednum : std_logic_vector(7 downto 0);signal key_tmp : std_logic_vector(3 downto 0);signal clk : std_logic;signal cntfrq1 : std_logic_vector

5、(5 downto 0);beginVGA = 0101;-键盘功效选择 scan = not scnlin; lednum = scnlin & (not key_tmp); -key_tmp keyin(0) ,DLY_OUT = key_tmp(0) ,clr=rst,clk = CLK);U2: debouncing PORT MAP (KEY = keyin(1) ,dly_out = key_tmp(1) ,clr=rst,clk = CLK );U3: debouncing PORT MAP (key = keyin(2) ,dly_out = key_tmp(2) ,clr=r

6、st, clk = CLK );U4: debouncing PORT MAP (key = keyin(3) ,dly_out = key_tmp(3) ,clr=rst, clk = CLK );END block debounuing ;-*- process(rst,clk_in) - 晶振为40MHz,进行40000分频产生去抖时钟(1000Hz) begin if rst = 0 then cntfrq 0); elsif rising_edge(clk_in) then if (cntfrq = 111 or not (key_tmp=1110 or key_tmp=1101 o

7、r key_tmp=1011 or key_tmp=0111) ) then -if (cntfrq = 111 or key_tmp=1111 ) then -if cntfrq = 1111 then cntfrq 0); clk = not clk;-去抖时钟 else cntfrq = cntfrq + 1; end if; end if; end process; process(rst,clk) -去抖时钟,50分频,形成扫描时钟beginif rst = 0 thenclkfrq = 0;cntfrq1 0);elsif rising_edge(clk) thenif cntfr

8、q1 = 11000 thencntfrq1 0);clkfrq = not clkfrq;elsecntfrq1 = cntfrq1 + 1;end if;end if;end process; process(rst,clkfrq) - 依据扫描时钟产生扫描线 begin if rst = 0 then cntscn = 00; elsif rising_edge(clkfrq) then if cntscn = 11 then cntscn = 00; else cntscn scnlin scnlin scnlin scnlin null; end case; end if; end

9、process; process(rst, clkfrq) - 依据按键点亮对应leds begin if(rst = 0 ) then leds leds leds leds leds leds leds leds leds leds leds leds leds leds leds leds leds null; end case; end if; end process;process(rst,key_tmp)beginif(rst = 0 ) thenstate = 1;elsif (key_tmp=1110 or key_tmp=1101 or key_tmp=1011 or key

10、_tmp=0111) thenstate = 0;elsif (key_tmp=1111) thenstate = 1;end if;end process; end keyboard4_4_arch;三、 心得体会经过两周课程设计,因为是第一次,过程有点曲折,有点累,但最终能得到理想结果,心里感到尤其快乐。因为是课程设计,需要制订一个最合理方案。这就锻炼了我们理论分析、比较,联络实际情况能力。因为需要各个方面材料和数据,我们需要利用多种手段去查找资料,这增加了我们自学能力。在电路生成和调试过程中,我们碰到了多种问题,经过对种种问题处理,我们在工程实际层次上更深入了解理论知识。我们不仅愈加好地了解了所学理论知识,更关键是把知识从书中提炼出来利用到生活当中,这是一个质飞跃。在这次课程设计当中也离不开老师帮助,她们尽心尽责给了我很大帮助,很感谢。

展开阅读全文
相似文档                                   自信AI助手自信AI助手
猜你喜欢                                   自信AI导航自信AI导航
搜索标签

当前位置:首页 > 学术论文 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服