




免费预览已结束,剩余30页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
概述在当今社会中,人们对于隐私的保护和对物品安全的重视程度与日俱增。因此,使用了现代电子技术的电子密码锁便有了广泛的应用前景。本次所设计的电子密码锁,能够实现该六位十进制并行密码保护,当输入的密码与锁内密码一致时,绿灯亮,开锁;当输入的密码与锁内的密码不一致时,红灯亮,不能开锁。密码锁的密码可由用户自行设置,并可在液晶显示屏上显示所输入的密码。为人们的财产、信息安全提供了可靠地保障。本次设计基于VHDL语言,对并行六位电子密码锁进行设计,并对设计过程进行了详细描述。采用VHDL语言进行电子密码锁的设计可使设计工作简洁直观,快速实现既定功能。电子密码锁在对财产安全保护等方面都有着重要作用,应用前景非常广泛。开锁代码为六位十进制数,当输入代码的位数和位值与锁内给定的密码一致,且按规定程序开锁时,方可开锁,并点亮开锁指示灯。否则,系统进入“错误”状态,并发出报警信号。开锁程序由设计者确定,并要求锁内给定的密码是可调的,且预置方便,保密性好。并行数字锁的报警方式是点亮指示灯,并使喇叭鸣叫来报警,直到按下复位开关,报警才停止。此时,数字锁又自动进入等待下一次开锁的状态。 一、 设计主要内容1、 密码锁串行输入几位十进制数字口令2、 输入口令全部正确即开锁并有绿灯显示3、 口令输入最大次数3次,要求在完全输入六位之后进行判断口令正确与否;输入3次之后还不能开锁,进入死锁状态并报警4、 有相应的显示功能5、 开锁后能再次上锁 二、系统设计方案 作为通用电子密码锁,主要由三个部分组成:数字密码输入电路、密码锁控制电路和密码锁显示电路。(1)密码锁输入电路包括时序产生电路、键盘扫描电路、键盘译码电路等几个小的功能电路。(2) 密码锁控制电路包括按键数据的缓冲存储电路,密码的清除、存储、激活电锁电路(寄存器清除信号发生电路),密码核对(数值比较电路),解锁电路(开/关门锁电路)等几个小的功能电路。(3)密码显示电路主要是在液晶显示屏显示输入的数值。 2.1密码锁输入电路的设计 是电子密码锁的输入电路框图,由键盘扫描电路、弹跳消除电路、键盘译码电路、按键数据缓存器,加上外接的一个44矩阵式键盘组成。798 按键数据键盘输入465 工作时钟脉冲信号键盘扫描信号弹跳消除电路键盘译码电路按键数据缓存器0321 键盘扫描电路 图1-1 密码锁的输入电路框图 1矩阵式键盘的工作原理KC1KC2 矩阵式键盘是一种常见的输入装置,在日常的生活中,矩阵式键盘在计算机、电话、手机、微波炉等各式电子产品上已经被广泛应用。图1-2是一个34矩阵式键盘的面板配置图,其中数字09作为密码数字输入按键。 KC0KR0(11)KR1(10) KR2(01)KR3(00)01111011110111103 021654798 图1-2 4 4矩阵式键盘的面板配置 2.2密码锁输入电路各主要功能模块的设计 1) 时序产生电路 本时序产生电路中使用了三种不同频率的工作脉冲波形:系统时钟脉冲(它是系统内部所有时钟脉冲的源头,且其频率最高)、弹跳消除取样信号、键盘扫描信号。 2) 键盘扫描电路 扫描电路的作用是用来提供键盘扫描信号的,扫描信号变化的顺序依次为11101101101101111110.依序地周而复始。 3) 弹跳消除电路 由于本设计中采用的矩阵式键盘是机械开关结构,因此在开关切换的瞬间会在接触点出现信号来回弹跳的现象,对于电子密码锁这种灵敏度较高的电路这种弹跳将很可能会造成误动作输入,从而影响到密码锁操作的正确性。 从图1-3中可以观察出弹跳现象产生的原因,虽然只是按下按键一次然后放掉,然而实际产生的按键信号却不止跳动一次,经过取样信号的检查后,将会造成误判断,以为键盘按了两次。如果调整抽样频率(如图4.5所示),可以发现弹跳现象获得了改善。 图1-3弹跳现象产生错误的抽样结果 图1-4 调整抽样频率后得到的抽样结果 4) 键盘译码电路 上述键盘中的按键可分为数字按键和文字按键,每一个按键可能负责不同的功能,例如清除数码、退位、激活电锁、开锁等。 5) 按键存储电路 因为每次扫描会产生新的按键数据,可能会覆盖前面的数据,所以需要一个按键存储电路,将整个键盘扫描完毕后的结果记录下来。按键存储电路可以使用移位寄存器构成。 图1-5 输入电路仿真波形图2.3 密码锁控制电路的设计 密码锁的控制电路是整个电路的控制中心,主要完成对数字按键输入和功能按键输入的响应控制。 1数字按键输入的响应控制 (1) 如果按下数字键,第一个数字会从显示器的最右端开始显示,此后每新按一个数字时,显示器上的数字必须左移一格,以便将新的数字显示出来。 (2) 假如要更改输入的数字,可以按倒退按键来清除前一个输入的数字,或者按清除键清除所有输入的数字,再重新输入六位数。 (3) 由于这里设计的是一个六位的电子密码锁,所以当输入的数字键超过四个时,电路不予理会,而且不再显示第六个以后的数字。 2.4功能按键输入的响应控制 (1) 清除键:清除所有的输入数字,即做归零动作。 (2) 激活电锁键:按下此键时可将密码锁的门上锁。(上锁前必须预先设定一个六位的数字密码。) (3) 解除电锁键:按下此键会检查输入的密码是否正确,若密码正确无误则开门。输入文字模式开始输入六位数字,在输入过程中可能用到删除键 上锁工作模式密码锁激活上锁开锁工作模式检查输入的密码是否有效核对输入的密码是否有效都正确后解除电锁 图1-5 电子密码锁的三种模式及关系2.5 密码锁显示电路的设计 密码锁显示电路的设计比较复杂,这里直接采用12864液晶屏进行显示。 2.6 密码锁的整体组装设计 将前面各个设计好的功能模块进行整合,可得到一个完整的电子密码锁系统的整体组装设计原理图,如图1-6所示。 图1-6 密码锁的整体组装设计原理图3、 系统扩展思路 (1) 本系统基本达到作为数字密码锁的绝大部分功能,但还有许多不足或需完善的地方。比如说采用44的通用机械键盘受到键盘数量的限制,在很大的程度上限制了其功能的扩展。 (2) 设计外围电路:系统用方波信号源,直流工作电源。(3) 可要求设计制作整个系统,包括PCB的制作。4、 实验收获 课程设计是培养学生综合运用所学知识,发现,提出,分析和解决实际问题,锻炼实践能力的重要环节,是对学生实际工作能力的具体训练和考察过程。随着科学技术发展的日新月异,FPGA已经成为当今计算机应用中空前活跃的领域,在生活中可以说无处不在。因此作为二十一世纪的大学来说掌握eda的开发技术是十分必要的。 回顾此次课程设计,我感慨颇多,的确,从理论到实践,在很长的一段时间里,可以说是苦多于甜,但确实学到了很多东西,不仅可以巩固以前学到的知识,还学到许多没学过的知识。通过此次课程设计,使我了解了理论与实际结合的重要性,只有理论知识是远远不够的。在设计的过程中,发现自己以前学习的知识理解不够深刻,掌握不够牢固等等。通过这次课设之后,一定要把以前学习的知识温故知新。 这次的课设终于完成,通过老师的细心讲解,我解决了很多问题。在这里,感谢老师的细心指导。同时对于帮助我的同学,也表示衷心感谢。 附录1、 液晶显示程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use IEEE.STD_LOGIC_ARITH.ALL;entity clock_lcd_disp is generic(divide_to_100k:integer:=500); port(clk:in std_logic; DATAIN:in std_logic_vector(31 downto 0); din: in INTEGER RANGE 15 DOWNTO 0; rw,rs,e,lcd_rst:out std_logic; lcd_data:out std_logic_vector(7 downto 0); end clock_lcd_disp;architecture tcl of clock_lcd_disp is signal mima:std_logic_vector(31 downto 0):=00010010001101000101011001111000; signal clk_100k:std_logic; signal clkout:std_logic; signal temp:std_logic_vector(7 downto 0); type state is(s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25,s26,s27,s28,s29,s30,s31); signal current_s:state; type data_buffer is array(0 to 15)of std_logic_vector(7 downto 0); type data_buffer1 is array(0 to 7)of std_logic_vector(7 downto 0); signal time:std_logic_vector(23 downto 0); signal disp_time:data_buffer1:=( x31,x32,x3a,x33, x34,x3a,x35,x36); constant data_buf0:data_buffer:=(x20,x20,xbb,xaa, -华科武昌分校 80 xbf,xc6,xce,xe4, xb2,xfd, xb7,xd6, xd0,xa3,x20,x20); constant data_buf1:data_buffer:=(x20,x20,xb5,xe7, -电子密码锁 90 xd7,xd3,xc3,xdc, xc2,xeb,xcb,xf8, x20,x20,x20,x20); constant data_buf2:data_buffer:=(x20,x20,xc7,xeb, xca,xe4,xc8,xeb, -请输入密码: 88 xc3,xdc,xc2,xeb, x3a,x20,x20,x20); constant data_buf3:data_buffer:=(x20,x20,xd6,xd8, xd0,xc2,xca,xe4, -重新输入 xc8,xeb,x20,x20, x20,x20,x20,x20); constant data_buf4:data_buffer:=(x20,x20,xbd,xe2, xcb,xf8,xb3,xc9, -解锁成功 xb9,xa6,x20,x20, x20,x20,x20,x20);constant data_buf5:data_buffer:=( x20,x20, -进入死锁状态 xbd,xf8,xc8,xeb, xcb,xc0,xcb,xf8, xd7,xb4,xcc,xac, x20,x20); constant data_buf6:data_buffer:=(x20,x20,xbd,xe2, - xcb,xf8,xb3,xc9, xb9,xa6, x21,x20, x20,x20,x20,x20); begin-U1:divclk1 port map(clk,clk_100k);process(clk) variable cnt:integer range 0 to divide_to_100k; begin if(clkevent and clk=1)then cnt:=cnt+1; if(cnt=divide_to_100k)then cnt:=0; end if; if(cntdivide_to_100k/2) then clk_100k=0; else clk_100k=1; end if; end if;end process;div_1Hz: process(clk) variable cnttemp:integer range 0 to 49999999; begin if clk=1 and clkevent then if cnttemp=49999999 then cnttemp:=0; else if cnttemp25000000 then clkout=1; else clkout=0; end if; cnttemp:=cnttemp+1; end if; end if;end process div_1Hz; disp_time(7)=DATAIN(3 downto 0)+x30; disp_time(6)=DATAIN(7 downto 4)+x30; disp_time(5)=DATAIN(11 downto 8)+x30; disp_time(4)=DATAIN(15 downto 12)+x30; disp_time(3)=DATAIN(19 downto 16)+x30; disp_time(2)=DATAIN(23 downto 20)+x30; disp_time(1)=DATAIN(27 downto 24)+x30; disp_time(0)rw=1;rs=1;e=1;cnt1:=cnt1+1; if cnt1500 then lcd_rst=0; elsif cnt11000 then lcd_rst=1; elsif cnt1=1000 then lcd_rst=1;cnt1:=0;current_scnt_1:=cnt_1+1; if cnt_11*3 then e=1;rs=0;rw=0; elsif cnt_12*3 then lcd_data=x0c; elsif cnt_110*3 then e=0; elsif cnt_1=10*3 then cnt_1:=0;current_scnt_1:=cnt_1+1; if cnt_11*3 then e=1;rs=0;rw=0; elsif cnt_12*3 then lcd_data=x90; elsif cnt_110*3 then e=0; elsif cnt_1=10*3 then cnt_1:=0;current_s if cnt_11*3 then e=1;rs=1;rw=0; elsif cnt_12*3 then lcd_data=data_buf1(data_cnt); elsif cnt_1=2*3 then data_cnt:=data_cnt+1; elsif cnt_1100 then e=0; end if; cnt_1:=cnt_1+1; if cnt_1=100 then cnt_1:=0; if data_cnt=16 then current_scnt_1:=cnt_1+1; if cnt_11*3 then e=1;rs=0;rw=0; elsif cnt_12*3 then lcd_data=x88; elsif cnt_110*3 then e=0; elsif cnt_1=10*3 then cnt_1:=0;current_s if cnt_11*3 then e=1;rs=1;rw=0; elsif cnt_12*3 then lcd_data=data_buf2(data_cnt); elsif cnt_1=2*3 then data_cnt:=data_cnt+1; elsif cnt_1100 then e=0; end if; cnt_1:=cnt_1+1; if cnt_1=100 then cnt_1:=0; if data_cnt=16 then current_scnt_1:=cnt_1+1; if cnt_11*3 then e=1;rs=0;rw=0; elsif cnt_12*3 then lcd_data=x80; elsif cnt_110*3 then e=0; elsif cnt_1=10*3 then cnt_1:=0;current_s if cnt_11*3 then e=1;rs=1;rw=0; elsif cnt_12*3 then lcd_data=data_buf0(data_cnt); elsif cnt_1=2*3 then data_cnt:=data_cnt+1; elsif cnt_1100 then e=0; end if; cnt_1:=cnt_1+1; if cnt_1=100 then cnt_1:=0; if data_cnt=16 then current_scnt_1:=cnt_1+1; if cnt_11*3 then e=1;rs=0;rw=0; elsif cnt_12*3 then lcd_data=x9a; elsif cnt_110*3 then e=0; elsif cnt_1=10*3 then cnt_1:=0;current_s if cnt_11*3 then e=1;rs=1;rw=0; elsif cnt_12*3 then lcd_data=disp_time(data_cnt); elsif cnt_1=2*3 then data_cnt:=data_cnt+1; elsif cnt_1100 then e=0; end if; cnt_1:=cnt_1+1; if cnt_1=100 then cnt_1:=0; if data_cnt=8 then current_scnt_1:=cnt_1+1; if din=10 then if cnt_11*3 then e=1;rs=0;rw=0; elsif cnt_12*3 then lcd_data=x88; elsif cnt_110*3 then e=0; elsif cnt_1=10*3 then cnt_1:=0;current_s=s11; end if; else current_s if cnt_11*3 then e=1;rs=1;rw=0; elsif cnt_12*3 then lcd_data=data_buf4(data_cnt); elsif cnt_1=2*3 then data_cnt:=data_cnt+1; elsif cnt_1100 then e=0; end if; cnt_1:=cnt_1+1; if cnt_1=100 then cnt_1:=0; if data_cnt=8 then current_scnt_1:=cnt_1+1; if cnt_11*3 then e=1;rs=0;rw=0; elsif cnt_12*3 then lcd_data=x88; elsif cnt_110*3 then e=0; elsif cnt_1=10*3 then cnt_1:=0;current_s if cnt_11*3 then e=1;rs=1;rw=0; elsif cnt_12*3 then lcd_data=data_buf3(data_cnt); elsif cnt_1=2*3 then data_cnt:=data_cnt+1; elsif cnt_1100 then e=0; end if; cnt_1:=cnt_1+1; if cnt_1=100 then cnt_1:=0; if data_cnt=8 then current_scnt_1:=cnt_1+1; if cnt_11*3 then e=1;rs=0;rw=0; elsif cnt_12*3 then lcd_data=x98; elsif cnt_110*3 then e=0; elsif cnt_1=10*3 then cnt_1:=0;current_s if cnt_11*3 then e=1;rs=1;rw=0; elsif cnt_12*3 then lcd_data=disp_time(data_cnt); elsif cnt_1=2*3 then data_cnt:=data_cnt+1; elsif cnt_1100 then e=0; end if; cnt_1:=cnt_1+1; if cnt_1=100 then cnt_1:=0; if data_cnt=8 then current_scnt_1:=cnt_1+1; if din=10 then if cnt_11*3 then e=1;rs=0;rw=0; elsif cnt_12*3 then lcd_data=x88; elsif cnt_110*3 then e=0; elsif cnt_1=10*3 then cnt_1:=0;current_s=s17; end if; else current_s if cnt_11*3 then e=1;rs=1;rw=0; elsif cnt_12*3 then lcd_data=data_buf4(data_cnt); elsif cnt_1=2*3 then data_cnt:=data_cnt+1; elsif cnt_1100 then e=0; end if; cnt_1:=cnt_1+1; if cnt_1=100 then cnt_1:=0; if data_cnt=8 then current_scnt_1:=cnt_1+1; if cnt_11*3 then e=1;rs=0;rw=0; elsif cnt_12*3 then lcd_data=x88; elsif cnt_110*3 then e=0; elsif cnt_1=10*3 then cnt_1:=0;current_s if cnt_11*3 then e=1;rs=1;rw=0; elsif cnt_12*
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025烟花买卖安全合同
- 农产品收购合同协议书
- 2024-2025学年新教材高中生物 第2章 细胞的结构和生命活动 第3节 第2课时 被动运输不需要细胞供能 主动运输需要细胞供能 细胞的胞吞和胞吐说课稿 苏教版必修1
- 第26课《诗词五首:春望》说课稿 2024-2025学年统编版语文八年级上册
- 本册综合说课稿-2025-2026学年初中劳动技术浙教版八年级上册-浙教版
- 九年级道德与法治下册 第二单元 世界舞台上的中国 第四课 与世界共发展 第2框 携手促发展说课稿+教学反思 新人教版
- 武汉市第一职业教育中心招聘高中教师2人笔试备考试题及答案解析
- 辅警招聘考试行政职业能力测验(常识判断)模拟试卷标准卷
- 重难点突破03 直线与圆的综合应用(七大题型)( )
- 安全主体责任培训讲义课件
- 2024年内蒙古人力资源和社会保障厅事业单位笔试真题
- 升降机风险辨识及防范措施
- 中医治未病健康宣教
- 食堂员工服务培训
- 提升心理抗压能力的技巧
- 中医医术确有专长人员(多年实践人员)医师资格考核申请表
- 低空飞行器设计
- 《穴位埋线疗法》课件
- 【大型集装箱船舶港口断缆事故预防应急处理及案例探析7500字(论文)】
- 脑梗塞并出血护理查房
- 三对三篮球赛记录表
评论
0/150
提交评论