基于单片机的智能密码锁的设计 下载本文

内容发布更新时间 : 2024/5/4 21:44:50星期一 下面是文章的全部内容请认真阅读。

沈阳理工大学学士学位论文

摘 要

随着科学技术的不断发展,人们对日常生活中的安全保险器件的要求越来越高。为满足人们对锁的使用要求,增加其安全性,用密码代替钥匙的密码锁应运而生。密码锁具具有安全性高、成本低、功耗低、易操作等优点。

本次设计使用STC89C52单片机为主体芯片。设计了一款可以多次修改密码、具有密码错误报警功能和无线开锁功能的无线遥控密码锁。本系统主要包括:矩阵键盘输入模块、LCD液晶显示模块、错误报警模块、无线开锁模块,所采用的编程语言是C语言。整机电路稳定性高,成本低,还能扩展很多功能。整个设计在Keil开发环境下,用C语言编写主控芯片的控制程序来实现具有多功能的电子密码锁。

电子密码锁设计的关键问题是实现密码的输入、清除、开锁、更改等功能。同时该密码锁具有设计方法合理,简单易行,成本低,安全实用等特点,符合住宅,办公室等场所的用锁要求,具有推广价值。

关键词:单片机;电子密码锁;矩阵键盘 ;无线收发模块

I

沈阳理工大学学士学位论文

Abstract

With the continuous development of science and technology, people's demands for safe and secured devices increase highly in daily life. In order to meet the requirements of the lock and to increase the security of it, the key with passwords instead of the lock comes into being. The key with passwords has the advantage of safety, low cost, low power consumption and easy operation.

The design use STC89C52 MCU for the main chip . A wireless remote control lock was designed, which can repeatedly change the password, also enjoy password error alarm functions and wireless unlock function. The system includes: matrix keyboard input module, LCD display module, error alarm modules, wireless input module. The whole circuit not only pocesses high stability and low cost, but also extends a lot of functions.The whole design in the KEIL development environment, using C language master control chip control procedures to achieve multifunctional electronic cipher lock.

The key question of the electronic lock designing is the realization of functions, such as the input password, clear password, unlock, change password and other functions.And the designed cipher lock is characterized by its reasonable designing methods, simple operation, low cost and property of safety and practicality.Besides,it works well as a residence lock and has great potential for commercial development.

Keywords: Singlechip; Electronic code lock; Matrix keyboard; Wireless transceiver module

II

沈阳理工大学学士学位论文

目 录

1 绪论 ........................................................................................................................................ 1

1.1 电子密码锁的概述 ...................................................................................................... 1 1.2 电子密码锁的现状及其发展 ...................................................................................... 1 1.3 课题研究的设计方案 .................................................................................................. 2 2 系统芯片介绍 ........................................................................................................................ 3

2.1 STC89C52单片机 ........................................................................................................ 3

2.1.1 STC89C52产品 ............................................................................................... 3 2.1.2 STC89C52引脚 ............................................................................................... 3 2.1.3 STC89C52系列单片机命名规则 ................................................................... 5 2.2 无线收发芯片CC1101 ................................................................................................ 5

2.2.1 CC1101芯片 ....................................................................................................... 5 2.2.2 CC1101主要特性 ............................................................................................... 5 2.2.3 CC1101主要参数 ............................................................................................... 7 2.2.4 CC1101芯片引脚 ............................................................................................... 7

3 系统硬件电路 ........................................................................................................................ 9

3.1 单片机最小系统 .......................................................................................................... 9

3.1.1 系统供电电路 .................................................................................................... 9 3.1.2 复位电路 .......................................................................................................... 10 3.1.3 时钟电路 .......................................................................................................... 11 3.2 单片机外围电路 ........................................................................................................ 12

3.2.1 矩阵键盘电路 .................................................................................................. 12 3.3.2 LCD1602液晶显示电路 .................................................................................. 13 3.3.3 报警和门铃电路 .............................................................................................. 17 3.3.4 CC1101模块电路 ............................................................................................. 19 3.3.5直流电机驱动电路 ........................................................................................... 21 3.3.6步进电机工作原理及驱动电路 ....................................................................... 22

4 系统软件的设计 .................................................................................................................. 25

4.1主程序流程图设计 ..................................................................................................... 25 4.2液晶显示器控制子程序 ............................................................................................. 27

III