天津工业大学单片机课程设计题目:基于单片机的密码锁设计系部机械工程学院专业测控技术与仪器班级测控1301学生姓名邱大均学号1310340115学生姓名夏海贝学号1310340123指导教师桑宏强2016年09月10日I摘要随着科技和人们的生活水平的提高,如何实现家庭防盗这一问题也变的尤其的突出,传统机械锁由于其本身锁芯密齿的有限加之开锁工具钥匙的容易复制性,使得其安全性大大降低,被撬事件屡见不鲜;相比之下,电子锁由于其保密性高,使用灵活性好,安全系数高,受到了广大用户的青睐。电子密码锁作为一种新型的锁,不仅拥有海量的密齿,通常从1000到10000000不等,还省去了传统机械锁的钥匙,使用者只要记得其密码,便可以开启,从而大大提高了防盗功能。本设计以单片机AT89C51作为密码锁监控装置的检测和控制核心,分为主机控制和从机执行机构(本设重点介绍主机设计),实现钥匙信息在主机上的初步认证注册、密码信息的加密、钥匙丢失报废等功能。根据51单片机之间的串行通信原理,这便于对密码信息的随机加密和保护。而且采用键盘输入的电子密码锁具有较高的优势。采用数字信号编码和二次调制方式,不仅可以实现多路信息的控制,提高信号传输的抗干扰性,减少错误动作,而且功率消耗低;反应速度快、传输效率高、工作稳定可靠等。软件设计采用自上而下的模块化设计思想,以使系统朝着分布式、小型化方向发展,增强系统的可扩展性和运行的稳定性。测试结果表明,本系统各项功能已达到本设计的所有要求。关键词:单片机;密码锁;单片机设计;电子锁IIAbstractWiththedevelopmentoftechnologyandpeople’slivingstandard,howtoachievefamilysecurityisbeenplacedonthetoppriory.Asthesafetyoftraditionalmechanicallockisgreatlydecreasedduetothelimitedtechnologyofkeycylinderandthecharacteristicthatiseasytocopy,itoftengetpriedbythethieves.Bycontrast,electroniccodelock,anewtypeoflock,isnotonlyfeaturedbyitssafety,privacyandflexibility,whichmakeitpopular.Itisalsoboredwithinnumerablesecretkeys,varyingfrom1,000to10,000,000.Theuserscouldunlockthedooraslongasheremembersthecode,decreasingthepossibilityofbeingstolen.Inthisdesign,SCMAT89C51functionasthetestingandcontrolkerneloftheappliancesthatmonitorthecodelock.AdeviceandBdevice,whichcouldrealizethefunctionofinitialauthenticationandregistration,encryptionofcodeinformationandmissingandscrapofthekeys,divideitintotwopartsthatarecontrolled.Accordingtotheprincipleofserialcommunication,it’sconvenienttorandomlyencryptandprotectcodeinformation.Moreover,theelectroniccodelockthatisimportedbykeyboardismorecompetitive.Achievingthecontrolofmultilinemessage,thepatternthatadoptdigitalinformationcodingandsecondarydebuggingcouldimprovetheanti-interferenceperformanceofsignaltransmission,reducewrongmovementandkeeplowconsumptionofpoweratthesametime.Italsoenjoystheadvantageofhighreflectionspeed,highefficiencyandworkingstability.UsingtheideaofmodularityIIIfromtoptobottom,thesoftwaredesignmakessystemdeveloptowardsminiaturization.Meanwhile,italsostrengthenstheexpandabilityandworkingstability.Fromthetestresultswecanseethattheentirerequirementhasbeensatisfied.Keywords:SCM,combinationlocks,thedesignofSCM,electroniclocksIV目录第一章绪论........................................................................................................................................................11.1引言...................................................................................................................................11.2电子密码锁的背景..........................................................................................................11.3电子锁设计的意义的本设计特点..................................................................................2第二章系统设计..............................................................................................................................................42.1系统总设计结构图...........................................................................................................42.2.开锁机构设计................................................................................................................42.3主控芯片AT89C51单片机的简介....................................................................................52.4外部存储E2PROM(AT24C01)简介..................................................................................8第三章系统硬件设计....................................................................................................................................123.1键盘设计..........................................................................................................................123.2系统电路设计:.............................................................................................................123.2.1晶振时钟电路..........................................................................................................123.2.2复位电路设计...........................................................................................................133.2.3串口引脚功能介绍...................................................................................................133.2.4其它引脚..................................................................................................................143.2.5显示电路设计..........................................................................................................143.2.6标准串口电路设计................................................................................................143.3电路图的绘制..................................................................................................................153.4元器件采购......................................................................................................................15第四章软件设计............................................................................................................................................174.1系统软件设计整体思路.................................................................................................174.3系统模块密码设