(完整word版)基于Verilog的FPGA的电子密码锁的设计.pdf

上传人:H****o 文档编号:55048405 上传时间:2022-10-29 格式:PDF 页数:16 大小:654.46KB
返回 下载 相关 举报
(完整word版)基于Verilog的FPGA的电子密码锁的设计.pdf_第1页
第1页 / 共16页
(完整word版)基于Verilog的FPGA的电子密码锁的设计.pdf_第2页
第2页 / 共16页
点击查看更多>>
资源描述

《(完整word版)基于Verilog的FPGA的电子密码锁的设计.pdf》由会员分享,可在线阅读,更多相关《(完整word版)基于Verilog的FPGA的电子密码锁的设计.pdf(16页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、基于 FPGA 的电子密码锁的设计报告摘要:基于 FPGA 设计的电子密码锁是一个小型的数字系统,与普通机械锁相比,具有许多独特的优点:保密性好,防盗性强,可以不用钥匙,记住密码即可开锁等。目前使用的电子密码锁大部分是基于单片机技术,以单片机为主要器件。在实际应用中,程序容易跑飞,系统的可靠性较差。本文介绍的一种基于现场可编辑门阵列 FPGA 器件的电子密码锁的设计方法,采用VHDL 语言对系统进行描述,并在 EP3C10E144C8 上实现。通过仿真调试,利用可编程逻辑器件FPGA 的电子密码锁的设计基本达到了预期目的。当然,该系统在一些细节的设计上还需要不断地完善和改进,特别是对系统的扩展

2、有很好的使用系统和设计的价值。关键词:现场可编程门阵列;VHDL 语言;电子密码锁The Report Of Electronic Code Lock Design Abstract:FPGA-based design of the electronic code lock is a small digital system.It has many unique advantages:good privacy and security,it do not need the key but remember password to unlock,and so on while it compar

3、e to ordinary mechanical locks.At present,the electronic code lock is most used of SCM technology.In practice,however,the process easy run to fly.So the reliability of this system is poor.The paper introduced a field programmable gate arrays FPGA devices to design electronic password lock.The VHDL l

4、anguage is used to describe the system and achieved in EP3C10E144C8.Though the simulation tests,using FPGA-based design of the electronic code lock can achieve the expected goal.Of course,some of the details of the system in the design of the need to constantly refined and improved,in particular the

5、 expansion of the system have a good design and practical value.Keyword:FPGA;VHDL language;electronic password lock 一、设计内容与要求1设计一个密码锁,密码为一个4 位的十进制数,密码固化在锁内2用户输入密码正确,则开锁(试验箱 D7 LED 灯亮);若不正确,则报警(试验箱 D0 LED 灯亮)3若用户输入密码不正确,可以按复位键重新输入密码。二、设计思想2.1 系统原理框图本系统由主控芯片(FPGA),键盘,显示电路,报警电路和开/关门电路组成,而主控芯片又可分为按键处理部分

6、,控制部分和译码显示部分。系统原理框图如图 2.1 所示:图 2.1 系统框图2.2 总体实现原理本系统有 8 个按键,K0,K1,K2,K3,K4,K5 代表数字 0-9 共 10 个数字和 1 个确认键,1 个复位键。密码长度为四位,并且固化在锁内,输入正确密码后,按确认键即可开门,本系统设置为LED D7 灯亮。在输入密码的过程中,当用户键键盘按键处理主控部分译码显示显示开/关门电路报警电路FPGA 文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H

7、4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2

8、Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3

9、C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K

10、8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3

11、K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9

12、X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T

13、5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8入错误密码时,报警灯LED D0 灯亮。按下复位键,可使报警停止,同时清除所有密码显示。三、芯片主控设计3.1 FPGA 有限状态机本设计是通过 FPGA 有限状态机来实现,设计有限状态机最开始的工作时要确定电路,包括哪些状态,比如某个电路包括四个状态,S0,S1,S2,S3。然后对所有状态给出一个状态编码,比如为状态 S0赋予编码 00,为状态 S1赋予编码 01,为状态 S2赋予编码 10,为状态 S3赋予编码 11。状态编码是状态的标识,保存在

14、寄存器当中,对于此编码形式,只需一个2 位的寄存器就可以了。FSM Encoding Style 主要有:Binary Encoding One Hot Encoding Gray Encoding 二进制与一位热码的特性比较:表 3.1 二进制与一位热码的特性比较文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编

15、码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5

16、 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6

17、ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文

18、档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4

19、B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q

20、6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C

21、8状态机可以认为是组合逻辑和寄存器逻辑的特殊租户,它一般包括两个部分:组合逻辑部分和寄存器逻辑部分。寄存器用于存储状态,组合电路用于状态译码和产生输出信号。状态机的下一个状态及输出,不仅与输入信号有关,而且还有寄存器当前所处的状态有关。根据输出信号产生方法的不同,状态机可以分成两类:Mealy 型和 Moore 型。Moore 型状态机的输出只是当前状态的函数,而 Moore 型状态机的输出只是当前状态的函数,而 Mealy 型状态机的输出则是当前状态和当前输入状态的函数。其原理如下两图:图 3.1Mealy 型状态机输出原理文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M

22、9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:C

23、F5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO

24、4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX1

25、0M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码

26、:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5

27、HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 Z

28、X10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8图 3.2 Moore 型状态机输出原理3.2 设计流程本次密码锁的设计,有限状态机应该包括以下状态:密码为输入前的等待状态、输入密码时的等待状态、输入密码正确时的通过状态、输入密码错误时的警报状态。图 3.3 主有效状态机的状态转换图其中当密码输入时又可包括以下状态,正常输入状态、异常输入状态(包括命令状态)、输入确认状态。下面

29、的图(图是在程序编译后,tools-Netlist_Vewers-RTL Vewer 得到的)表示了密码输入的时候的次状态机,表示了 4 个密码输入的顺序状态,以及输入完成后的等待确认状态。图 3.4 次有效状态机的状态转换3.3 状态编码状态编码主要有二进制编码、格雷编码和一位独热编码等方式。格雷编码时,相邻状态每次只有一个比特位产生变化,这样减少了瞬变的次文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9

30、X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T

31、5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8

32、V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9

33、D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF

34、5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4

35、S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10

36、M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8数,也减少了产生毛刺和一些状态的可能。采用一位独热编码,虽然多用了触发器,当可以有效节省和简化组合电路。对于寄存器数量多而逻辑相对缺乏的FPGA 器件来说,采用一位独热编码可以有效提高电路的速度和可靠性,也有利于提高器件资源的利用率。将产生状态的组合逻辑电路和用于保存状态的寄存器分别写在不同的always块中。其中主要包括:输出控制部分、警报计时部分、锁打开后的计时部分、比较密码部分、记录密码部分和记录错误次数的部分3.4 密码的输入本次密码锁的密码输入采用FPGA 芯片上的 8 位单个按键,考虑

37、到按键数目不够,采用了一位按键作为功能转换按键;即前5 位按键输入 04,同时按下功能转换按键时,按键04 即转换为按键 59,这就弥补了按键数目的不足。最后两位按键设定为确认输入按键和复位按键。密码输入完成后可以按确认键检验密码的正误,报警、输入错误或者其他情况可以按复位按键重新输入。另外由于按键的时候同时会引起状态机的转换,所以如果按键的时候对按键判断次数过多会产生状态的过快转换,记录的密码和数码管的显示就同时会出现错误,因此在按键部分加入了消除多重按键的程序,只检测一次按键的下降沿,解决了这个问题。3.5 密码记录与比较程序设定了一个寄存器用来记录输入的密码。当次有效状态机(即密码输入的

38、状态机)发生转换并且有密码输入时,程序会记录下输入的密码在寄存器的其中 4 位里面,最后次有效状态转换到确认密码的状态时,会将记录下的密码与固化在锁内的密码进行对比,正确即将主状态机转换到通过阶段,错误则将状态机转换到报警阶段。其中正确错误的状态转换是通过控制相应的标志位实现的。3.6 密码的显示密码显示采用数码管动态扫描显示,初始时显示密码为4 位 0,当输入密码后数码管的第一位、第二位、第三位、第四位会依次显示输入的密码,错误后复文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C

39、8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8

40、H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K

41、2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X

42、3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5

43、K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V

44、3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D

45、9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8位可以重新输入。密码显示采用的是记录密码的寄存器的数据,显示扫描的扫描时间设置为 1ms 左右,这样显示不会出现闪烁或者残影。四、程序仿真下前面的输入 cmd的编码:/输入的数字编码09,enter,cancel one=4b0001,two=4b0010,three=4b0011,four=4b0100,five=4b0101,six=4b0110,seven=4b0111,eight=4b1000,nine=4b100

46、1,zero=4b1000,enter=4b1010,cancel=4b1011;可以看到,在复位以后,输入第1,2,3,4 个密码(依次为1111)后,passed 变成高电平当过了一定的时间后,passed 变成低电平,重新计入键盘读入值,进行下一轮的密码辨别。文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编

47、码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5

48、 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6

49、ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文

50、档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4B5 HO4S8V3K2Q6 ZX10M9D9X3C8文档编码:CF5T5K8H4

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 高考资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁