摘要在日常的生活和工作中,住宅与部门的安全防范、单位的文件档案、财务报表以及一些个人资料的保存多以加锁的办法来解决。若使用传统的机械式钥匙开锁,人们常需携带多把钥匙,使用极不方便,且钥匙丢失后安全性即大打折扣。具有防盗报警等功能的电子密码锁代替密码量少、安全性差的机械式密码锁已是必然趋势。随着科学技术的不断发展,人们对日常生活中的安全保险器件的要求越来越高。为满足人们对锁的使用要求,增加其安全性,用密码代替钥匙的密码锁应运而生。密码锁具有安全性高、成本低、功耗低、易操作、记住密码即可开锁等优点。目前使用的电子密码锁大部分是基于单片机技术,以单片机为主要器件,其编码器与解码器的生成为软件方式。本系统由STC89C51单片机系统(主要是STC89C51单片机最小系统)、4×4矩阵键盘、LCD1602显示和报警系统等组成,具有设置、修改六位用户密码、超次报警、超次锁定、密码错误报警等功能。关键词:STC-89C51、LCD1602、电子密码锁、4×4矩阵键盘AbstractInourdailylifeandwork,thesecurityofresidentialanddepartment,thefileoftheunit,thefinancialreportandthepreservationofsomepersonaldataaremoreandmore.Ifusingthetraditionalmechanicalkeytounlock,peopleoftenneedtocarrymorethanthekey,theuseofextremelyinconvenient,andthekeyislostafterthesecurityisgreatlyreduced.Itisaninevitabletrendtohaveamechanicalcipherlockwhichhasthefunctionofantitheftalarm,lesspasswordlock,lesssecurity.Withthecontinuousdevelopmentofscienceandtechnology,people'sdailylifeinthesafetyofthedeviceisincreasinglyhighrequirements.Inordertomeettherequirementsoftheuseofthelock,increaseitssecurity,withapasswordtoreplacethekeytothepasswordlockcameintobeing.Thepasswordlockhastheadvantagesofhighsecurity,lowcost,lowpowerconsumption,easyoperation,rememberpasswordcanunlockandsoon.Atpresent,mostoftheelectroniccipherlockisbasedonSCMtechnology,withthesinglechipmicrocomputerasthemaindevice,theencoderanddecoderaregeneratedasthesoftwaremode.ThissystemiscomposedofSTC89C51microcontrollersystem(STC89C51),4*4matrixkeyboard,LCD1602displayandalarmsystem,etc.,whichhasthefunctionsofsettingupandmodifyingsixuserpasswords,superalarm,superlock,passworderroralarmandsoon.Keywords:STC-89C51;LCD1602;Electronicpasswordlock;4×4keyboard目录1.引言...............................................................11.1.研究背景......................................................11.2.设计内容及要求................................................12.硬件设计...........................................................32.1.系统整体设计..................................................32.2.子电路设计....................................................42.2.1.单片机STC89C51简介.....................................42.2.2.AT24C02存储芯片.........................................62.2.3.LCD显示模块.............................................82.2.4.键盘设计...............................................112.2.5.声音提示模块...........................................122.2.6.继电器控制模块.........................................133.软件设计..........................................................153.1.系统整体流程图...............................................153.2.键盘扫描子程序...............................................163.3.系统模块密码设置子程序.......................................163.4.开锁子程序...................................................184.调试与测试........................................................194.1.焊接注意事项:...............................................194.1.1.LCD...