《单片机技术》课程设计说明书
密码锁
院 、 部: 电气与信息工程学院 学生姓名: 周鹏 指导教师: 王韧 职称 副教授 专 业: 通信工程 班 级: 1103 完成时间: 2013.12.20
摘 要
在日常的生活和工作中,住宅与部门的安全防范、单位的文件档案、财务报表以及一些个人资料的保存多以加锁的办法来解决。密码锁具有安全性高、成本低、功耗低、易操作等优点。基于以上思路,本次设计使用ATMEL公司的AT89S52实现-基于单片机的电子密码锁的设计,其主要具有如下功能:(1)设置6位密码,密码通过键盘输入,若密码正确,则将锁打开。(2)密码可以由用户自己修改设定(只支持6位密码),锁打开后才能修改密码。修改密码之前必须再次输入密码,在输入新密码时候需要二次确认,以防止误操作。(3) 报警、锁定键盘功能。密码输入错误数码显示器会出现错误提示,若密码输入错误次数超过3次,蜂鸣器报警并且锁定键盘。
主要的设计实施过程:首先,选用ATMEL公司的单片机AT89S52,以及选购其他电子元器件。第二步,使用DXP2004设计硬件电路原理图,并设计PCB图完成人工布线。第三步,并且使用 Keil-uVision4软件编写单片机的汇编语言程序、仿真、软件调试。第四部,使用PROTEUS 软件进行模拟软、硬件调试。最后,联合软、硬件调试电路板,完成本次毕业设计。
关键词:密码锁;AT89S52;4×4矩阵键盘;
Abstract
In our daily life, the security of house,company department, documents and finance forms, also some personal information always used the lock to protect them. The cipher has higher security, lower cost, lower power and easy to use. Base on the thinking of the cipher lock, this design uses AT89S52 of ATMEL COMPANY to carry out the SCM digital cipher lock, its main function as follow: 1. set password with 6 words, enter the words via keyboard, if enter the right number, the lock will unlock. 2. Password can set and fix by yourself, you can just fix the password when the lock is keeping unlock. It needs to enter the new password twice to avoid the wrong activity. 3. Alarm function. If enter the wrong password, the digital tube will show the error message, when enter the wrong password over 3 times, the buzzer will alarm and lock the keyboard at the same time.
The main process:first, use SCM AT89S52 of ATMEL Company.Second, design the theory chart with DXP 2004, and design the PCB board. Third, compile the C lang. program, resemble,and test with software keil-uVision3. Fourth, simulate the hardware test with software PROTEUS. LAST, test the circuit board with the software and hardware, finish.
Keywords: LED digital tube;AT89S52;matrix keyboard
目 录
1 引言............................................................. 1 1.1 电子密码锁简介.............................................. 1 1.2 设计目的与任务:............................................ 1 1.3 设计内容与要求.............................................. 1 1.4 本设计所要实现的目标........................................ 1 1.5 设计总体方案及工作原理说明.................................. 2 2 硬件系统的设计................................................... 3 2.1 设计原理.................................................... 3 2.2 电路总体构成................................................ 3 2.3 图纸及元器件清单............................................ 5 2.4 主要元器件介绍.............................................. 5 3 软件系统的设计................................................... 8 3.1 软件设计所用到的单片机资源情况.............................. 8 3.2 软件系统的模块功能.......................................... 8 3.3 软件系统主要程序设计流程图.................................. 8 3.4 软件系统程序清单........................................... 11 4 结 论........................................................... 12 4.1 设计结论及使用说明......................................... 12 4.2 程序仿真................................................... 12 4.3 实物调试结果............................................... 12 4.4 设计体会................................................... 13 4.5 教学建议................................................... 14 参考文献........................................................... 15 致 谢............................................................. 16 附 录............................................................. 17 附录A: 原理图 ................................................ 17 附录B: 原理图CAD ............................................. 18 附录C: 底层布线 .............................................. 19 附录D: 顶层布线 .............................................. 20
附录E: 元器件布局 ............................................ 21 附录F: 元器件清单 ............................................ 22 附录G: 主程序清单 ............................................ 23