毕业设计(论文)基于单片机的电子密码锁设计TheDesignofElectronicPassword-lockwithSCM:********:电气与信息学院:*****:****:*****:副教授:2008年6月20日学生姓名所在院系所学专业所在班级指导教师教师职称完成时间(论文)摘要随着电子产品向智能化和微型化的不断发展,单片机已成为电子产品研制和开发中首选的控制器。随着人们生活水平的提高,如何实现家庭防盗这一问题也变的尤其的突出,传统的机械锁由于其构造的简单,安全性能低,无法满足人们的需要。本文从经济实用的角度出发,采用美国Atmel公司的单片机AT89S51与低功耗CMOS型E2PROMAT24C02作为主控芯片与数据存储器单元,结合外围的键盘输入、显示、报警、开锁等电路,用汇编语言编写主控芯片的控制程序,设计了一款可以多次更改密码具有报警功能的电子密码锁。经实验证明,该密码锁具有设计方法合理,简单易行,成本低,安全实用等特点,符合住宅、办公室用锁要求,具有推广价值。关键词密码锁单片机报警AbstractAselectronicproductsaredevelopingtowardsintelligenceandminimization,single—chipcomputers(SCM)havebecomethefirstchoiceforcontrollersinthedevelopmentofelectronicproducts.Withtheimprovementofpeople'slivingstandards,(论文)ithasbecomeparticularlyprominentabouthowtoachieveAnti-theftfamily.Thetraditionalmechanicallockhassuchshortcomingassimplestructure,Lowsecurity,itcan'tmeetpeople'sdemands.Forpracticality,thispaperdesignsanewelectroniccipherlock,whichhasthefunctionofalarmandwhoseciphercanbechangedmanytimes.ThiscipherlockusesAT89S51SCMandE2PROMAT24C02asmainchipanddatamemorycell.TheauthormadethisciphorlockbyuseofmakingcontrolledprogramofmasterCMOSwithperipheryelectrocircuitofkeyboardinput,display,alarmandunlock.Experimentsshowthatthedesignedcipherlockischaracterizedbyitsreasonabledesigningmethods,simpleoperation,lowcostandpropertyofsafetyandpracticality.Besides,itworkswellasaresidencelockandhasgreatpotentialforcommercialdevelopment.Keywords:CipherlockSCMAlarm(论文)I目录1引言······························································································11.1电子密码锁简介········································································11.2电子密码锁的发展趋势·······························································11.3本设计所要实现的目标·······························································22设计方案的选择···············································································32.1方案一:采用数字电路控制·························································32.2方案二:采用以单片机为核心的控制方案······································33主要元器件介绍···············································································43.1主控芯片AT89S51····································································43.2存储芯片AT24C02····································································93.3LCD1602显示器·····································································103.4晶体振荡器············································································124系统硬件构成················································································134.1设计原理···············································································134.2电路总体构成·········································································134.3电源输入部分·········································································144.4键盘输入部分·········································································154.5密码存储部分·········································································154.6复位部位···············································································164.7晶振部分···············································································174.8显示部分···············································································184.9报警部分···············································································184.10开锁部分···············································································195系统软件设计················································································206结论····························································································24谢辞·································································································25(论文)II参考文献:························································································25附录一······························································································27附录二·····································································错误!未定义书签。(论文)11引言1.1电子密码锁简介电子密码锁是一种通过密码输入来控制电路或是芯片工作,从而控制机械开关的闭合,完成开锁、闭锁任务的电子产品。它的种类很多,有简易的电路产品,也有基于芯片的性价比较高的产品。现在应用较广的电子密码锁是以芯片为核心,通过编程来实现的。其性能和安全性已大大超过了机械锁。其特点如下:1)保密性好,编码量多,远远大于弹子锁。随机开锁成功率几乎为零。2)密码可变,用户可以随时更改密码,防止密码被盗,同时也可以避免因人员的更替而使锁的密级下降。3)误码输入保护,当输入密码多次错误时,报警系统自动启动。4)无活动零件,不会磨损,寿命长。5)使用灵活性好,不像机械锁必须佩带钥匙才能开锁。6)电子密码锁操作简单易行,一学即会]4[。1.2电子密码锁的发展趋势在日常生活和工作中,住宅与部门的安全防范、单位的文件档案、财务报表以及一些个人资料的保存多以加锁的办法来解决。目前门锁主要用弹子锁,其钥匙容易丢失;保险箱主要用机械密码锁,其结构较为复杂,制造精度要求高,成本高,且易出现故障,人们常需携带多把钥匙,使用极不方便,且钥匙丢失后安全性即大打折扣。针对这些锁具给人们带来的不便若使用机械式钥匙开锁,为满足人们对锁的使用要求,增加其安全性,用密码代替钥匙的密码锁应运而生。它的出现为人们的生活带来了很大的方便,有很广阔的市场前景。由于电子器件所限,以前开发的电子密码锁,其种类不多,保密性差,最基本的就是只依靠最简单的模拟电子开关来实现的,制作简单但很不安全,在后为多是基于EDA来实现的,其电路结构复杂,电子元件繁多,也有使用早先的20引角的2051系列单片机来实现的,但密码简单,易破解。随着电子元件的进一步发展,电子密码锁也出现了很多的种类,功能日益强大,使用更加方便,安全保密性更强,由以前的单密码输入发展到现在的,密码加感应元件,实现了真真的电子加密,用户只有密码或电子钥匙中的一样,是打不开锁的,随着电子元件的发展及人们对保密性需求的提高出现了越来越多的电子密码锁]10[。出于安全、方便等方面的需要许多电子密码锁已相继问世。但这类产品的特点是针对特定有效卡、指纹或声音有效,且不能实现远程控制,只能适用于保密要求高且供个人使用的箱、柜、房间等。由于数字、字符、图形图像、人体生物特征和时间等要素均可成为钥匙的电子信息,组合使用这些信息能够使电子防盗锁获得高度的保密性,如防范森严的金库,需要使用复合信息密码的电子防盗锁,这样对盗贼而言是“道高一尺、魔高一丈”。组合使用(论文)2信息也能够使电