EDA课程设计键盘扫描电路设计.docx

上传人:b****3 文档编号:3752412 上传时间:2023-05-06 格式:DOCX 页数:9 大小:26.38KB
下载 相关 举报
EDA课程设计键盘扫描电路设计.docx_第1页
第1页 / 共9页
EDA课程设计键盘扫描电路设计.docx_第2页
第2页 / 共9页
EDA课程设计键盘扫描电路设计.docx_第3页
第3页 / 共9页
EDA课程设计键盘扫描电路设计.docx_第4页
第4页 / 共9页
EDA课程设计键盘扫描电路设计.docx_第5页
第5页 / 共9页
EDA课程设计键盘扫描电路设计.docx_第6页
第6页 / 共9页
EDA课程设计键盘扫描电路设计.docx_第7页
第7页 / 共9页
EDA课程设计键盘扫描电路设计.docx_第8页
第8页 / 共9页
EDA课程设计键盘扫描电路设计.docx_第9页
第9页 / 共9页
亲,该文档总共9页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

EDA课程设计键盘扫描电路设计.docx

《EDA课程设计键盘扫描电路设计.docx》由会员分享,可在线阅读,更多相关《EDA课程设计键盘扫描电路设计.docx(9页珍藏版)》请在冰点文库上搜索。

EDA课程设计键盘扫描电路设计.docx

EDA课程设计键盘扫描电路设计

EDA课程设计--键盘扫描电路设计

 

电子课程设计

—键盘扫描电路设计

 

学院:

班级:

姓名:

学号:

指导老师:

2009年12月

 

1.设计任务与要求……………………………………………1

2.功能模块……………………………………………………2

3.选择器件……………………………………………………3

4.功能模块……………………………………………………5

5.设计总体电路图……………………………………………8

6.心得体会…………………………………………………10

 

一、设计任务与要求

1、键盘按钮数为4,系统时钟10MHz;

2、能识别出所按按钮;

3、按钮被按下后,视为此按钮输入一次,若按钮长时间不松,(时限1S)后每隔0.5S视为再次输入,直至按钮松开;

4、要求能对按钮按下时指令的抖动能正确处理。

对持续时间小于50ms的输入不作响应;

5、各键设置不同优先级,多键同时按下时,视为优先级较高的按键被按下;

二、功能模块

图3模块delta

其VHDL语言如下:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

useieee.std_logic_unsigned.all;

entitykeyboard4_4is

port(

rst:

instd_logic;

clk_in:

instd_logic;

keyin:

instd_logic_vector(3downto0);

scan:

outstd_logic_vector(3downto0);

leds:

outstd_logic_vector(3downto0);

state:

outstd_logic;

VGA:

outstd_logic_vector(3downto0)

);

endkeyboard4_4;

architecturekeyboard4_4_archofkeyboard4_4is

--

--*********************************************

componentdebouncing

port(key:

INSTD_LOGIC;

clk,clr:

INSTD_LOGIC;

dly_out:

OUTSTD_LOGIC);

endcomponent;

--*********************************************

--

signalclkfrq:

std_logic;

signalcntscn:

std_logic_vector(1downto0);

signalscnlin:

std_logic_vector(3downto0);

signalcntfrq:

std_logic_vector(14downto0);

--signalcntfrq:

std_logic_vector(3downto0);

signallednum:

std_logic_vector(7downto0);

signalkey_tmp:

std_logic_vector(3downto0);

signalclk:

std_logic;

signalcntfrq1:

std_logic_vector(5downto0);

begin

VGA<="0101";--键盘功能选择

scan<=notscnlin;

lednum<=scnlin&(notkey_tmp);

--key_tmp<=keyin;

--debounuingckt

debounuing:

block

begin

U1:

debouncingPORTMAP(

KEY=>keyin(0),

DLY_OUT=>key_tmp(0),

clr=>rst,

clk=>CLK

);

U2:

debouncingPORTMAP(

KEY=>keyin

(1),

dly_out=>key_tmp

(1),

clr=>rst,

clk=>CLK

);

U3:

debouncingPORTMAP(

key=>keyin

(2),

dly_out=>key_tmp

(2),

clr=>rst,

clk=>CLK

);

U4:

debouncingPORTMAP(

key=>keyin(3),

dly_out=>key_tmp(3),

clr=>rst,

clk=>CLK

);

ENDblockdebounuing;

--

--******************************************************

--

process(rst,clk_in)--晶振为40MHz,进行40000分频产生去抖时钟(1000Hz)

begin

ifrst='0'then

cntfrq<=(others=>'0');

elsifrising_edge(clk_in)then

if(cntfrq="100111000011111"ornot(key_tmp="1110"orkey_tmp="1101"orkey_tmp="1011"orkey_tmp="0111"))then

--if(cntfrq="100111000011111"orkey_tmp="1111")then

--ifcntfrq="1111"then

cntfrq<=(others=>'0');

clk<=notclk;--去抖时钟

else

cntfrq<=cntfrq+1;

endif;

endif;

endprocess;

process(rst,clk)--去抖时钟,50分频,形成扫描时钟

begin

ifrst='0'then

clkfrq<='0';

cntfrq1<=(others=>'0');

elsifrising_edge(clk)then

ifcntfrq1="11000"then

cntfrq1<=(others=>'0');

clkfrq<=notclkfrq;

else

cntfrq1<=cntfrq1+1;

endif;

endif;

endprocess;

process(rst,clkfrq)--根据扫描时钟产生扫描线

begin

ifrst='0'then

cntscn<="00";

elsifrising_edge(clkfrq)then

ifcntscn="11"then

cntscn<="00";

else

cntscn<=cntscn+1;

endif;

casecntscnis

when"00"=>scnlin<="0001";

when"01"=>scnlin<="0010";

when"10"=>scnlin<="0100";

when"11"=>scnlin<="1000";

whenothers=>null;

endcase;

endif;

endprocess;

process(rst,clkfrq)--根据按键点亮相应的leds

begin

if(rst='0')then

leds<=not"1111";

elsifclkfrq'eventandclkfrq='0'then

caselednumis

when"00010001"=>

leds<=not"0001";--1

when"00010010"=>

leds<=not"0010";--2

when"00010100"=>

leds<=not"0011";--3

when"00011000"=>

leds<=not"1010";--A

when"00100001"=>

leds<=not"0100";--4

when"00100010"=>

leds<=not"0101";--5

when"00100100"=>

leds<=not"0110";--6

when"00101000"=>

leds<=not"1011";--B

when"01000001"=>

leds<=not"0111";--7

when"01000010"=>

leds<=not"1000";--8

when"01000100"=>

leds<=not"1001";--9

when"01001000"=>

leds<=not"1100";--C

when"10000001"=>

leds<=not"1110";--*

when"10000010"=>

leds<=not"0000";--0

when"10000100"=>

leds<=not"1111";--#

when"10001000"=>

leds<=not"1101";--D

whenothers=>

null;

endcase;

endif;

endprocess;

process(rst,key_tmp)

begin

if(rst='0')then

state<='1';

elsif(key_tmp="1110"orkey_tmp="1101"orkey_tmp="1011"orkey_tmp="0111")then

state<='0';

elsif(key_tmp="1111")then

state<='1';

endif;

endprocess;

endkeyboard4_4_arch;

三、心得体会

经过两周的课程设计,由于是第一次,过程有点曲折,有点累,但最后能得到理想的结果,心里感到特别高兴。

因为是课程设计,需要制定一个最合理的方案。

这就锻炼了我们理论分析、比较,联系实际情况的能力。

由于需要各个方面的材料和数据,我们需要运用各种手段去查找资料,这增长了我们自学的能力。

在电路的生成和调试过程中,我们遇到了各种问题,通过对种种问题的解决,我们在工程实际的层次上更进一步理解理论知识。

我们不仅更好地理解了所学的理论知识,更重要的是把知识从书中提炼出来运用到生活当中,这是一种质的飞跃。

在这次课程设计当中也离不开老师的帮助,他们尽心尽责给了我很大的帮助,非常感谢。

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 党团工作 > 入党转正申请

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2