1、 I 基于单片机的门禁系统设计 摘 要 针对日常生活中小区住宅的安全防范,一般的门锁使用极不方便,为满足人 们对门锁的使用需求,增加其安全性,基于单片机的门禁系统应运而生。本设计 采用单片机 AT89S51 作为主控中心, 以键盘密码的输入方式实现对门的出入控制, 或者通过键盘输入门号的方式,进行对讲方式住户实现开门。适用于普通小区单 元楼的进入控制,该系统可实现密码输入开门、语音对讲开门、密码修改、报警 和锁定键盘等功能 ,同时该门禁系统还具有设计方法合理,简单易行,成本低, 安全实用等特点,符合一般小区的使用需求,具有推广价值。 关键词:关键词: 门禁系统;密码锁;AT89S51;44 矩
2、阵键盘 II ABSTRACT Contrary to the security for the daily life of the residential district, generally locks is not that convenient to use. In order to meet the users needs about the security of the locks.So a microcontroller-based Access Control System control system came into being. This design based
3、on a microcontroller AT89S51 which works as the control center, keyboard password input achieved the door access control, or by way of keyboard inputing numbers,and intercom way households the door. Applicable to ordinary residential unit building access control.This system can achieve password ente
4、r the door, voice intercom to open the door, password changes, the alarm and lock the keyboard and other functions.while the access control system also has a rational design method which is so simple, low cost,so safety and with many practical features,which can meet the general needs of the distric
5、t, also is worth promoting. Key words: entrance guard system; Combination lock; AT89S51; 4 x 4 matrix keyboard 目 录 摘摘 要要 . I ABSTRACT. II 第第 1章章 前前 言言 1 1.1 门禁系统的定义 . 1 1.2 门禁系统的发展现状和趋势 . 2 1.3 门禁系统的背景以及研究目的和意义 . 3 1.4 门禁系统研究的主要内容 . 4 1.4.1 总体设计方案选定 . 4 1.4.2 门禁系统单片机硬件资源的分配 . 6 第第 2章章 系统的硬件设计系统的硬件设计
6、 7 2.2 单片机最小系统设计 . 7 2.1.1 AT89S51 简介 7 2.1.2 单片机晶振电路 . 9 2.1.3 单片机复位电路 . 9 2.2 键盘电路 . 10 2.3 显示电路 11 2.3.1 数码管简介 11 2.3.2 驱动芯片简介 . 12 2.3.3 显示电路设计 . 13 2.4 语音电路 . 14 2.4.1 MC34118 的简介 . 14 2.4.2 语音电路设计 . 17 2.5 开锁电路 . 18 2.6 报警电路 . 19 2.7 掉电密码保护 . 20 2.7.1 AT24C02 存储芯片简介 . 20 2.7.2 掉电密码保护设电路计 . 21 第第 3章章 系统的软件设计系统的软件设计 22 3.1 系统的总体软件流程 . 22 3.2 各部分的功能实现程序设计 . 24 3.2.1 初始化程序 . 24 3.2.2 键盘扫描子程序 . 24 3.2.3 密码比较和报警程序 . 26 3.2.4 密码更改程序 . 27 3.2.5 数码管显示部分驱动程序 . 28 3.2.6 单片机通讯程序 . 28 3.2.7 语音拨号程序