摘 要
随着微机测量和控制技术的迅速发展与广泛应用,以单片机为核心的电子密码锁的设计研发与应用在很大程度上改善了人们的生活,尤其是在一些公共场合(比如大型超市)保存私人物品等方面起到了不可估量的作用。本设计论述了一种以STC89C52单片机为主控制单元,以LCD1602为显示器件的电密码锁系统。该控制系统可以每次随机生成四位数的密码,并显示在LCD上,用户记住改密码后进行输入并核对是否正确。系统设计了相关的硬件电路和相关应用程序。硬件电路主要包括STC89C52单片机最小系统,LCD显示电路、LED指示电路,按键电路等等。系统程序主要包括主程序,密码生成和校验程序、LCD显示程序以及按键模块程序等。
关键词: 密码;单片机;LCD1602
Abstract
Along with the rapid development and wide application of computer measurement and control technology, single-chip microcomputer as the core of the electronic code lock design development and application in a large extent improve the people's lives, especially in some public places (such as large supermarket) save private goods, to an immeasurable role. The design of a STC89C52 microcontroller based control unit, with LCD1602 as the display device of the electrical code lock system. The control system can be randomly generated four digit password, and displayed on the LCD, the user remember to change the password after the input and check whether the correct. The related hardware circuit and related applications are designed. The hardware circuit mainly includes STC89C52 MCU minimum system, LCD display circuit, LED indication circuit, key circuit and so on. System program mainly includes the main program, password generation and calibration procedures, LCD display program, as well as key module program, etc..
[Keywords] : Password;MCU;LCD1602
目 录
一、引言 3
1.1 课题研究背景及意义 3
1.2 课题设计的目的以及主要内容 4
二、系统硬件设计 5
2.1、系统硬件总体设计 5
2.2 单片机型号的选择 6
1.STC89C52单片机简介 6
2.STC89C52单片机时序 7
3.STC89C52单片机引脚介绍 7
2.3 单片机最小系统 9
2.4 LCD选型 11
2.5 LCD电路设计 13
2.6 LED提示电路 14
2.7 继电器电路 14
2.8 按键电路 14
三、系统软件设计 16
3.1 LCD子程序模块 17
3.3 按键模块流程图 19
3.4 LED指示灯流程图 20
参考文献 21
致谢 22