基于单片机的电子门禁系统设计

摘 要

门禁系统采用89C52 单片机作为控制核心,外围加蜂鸣器控制电路、开门指示灯电路、电控锁控制电路以及LCD液晶显示电路等。门禁系统主要由CPU、工作指示电路、振荡电路、蜂鸣器电路、门控锁电路、矩阵键盘、读卡模块、显示模块等组成。该门禁系统采用射频卡完成刷卡进门,按刷卡出门等功能。其工作原理为:当刷卡时,蜂鸣器响一下,如卡权限获得允许,显示模块显示卡号,同时继电器动作将门锁打开,指示灯点亮,延时一段时间后继电器再次动作将门锁锁闭,指示灯熄灭。当按下出门按钮时,继电器动作将门锁打开,指示灯点亮,延时一段时间后继电器再次动作将门锁锁闭,指示灯熄灭。当输入初始密码时,若输入正确,继电器动作将门锁打开,指示灯点亮,延时一段时间后继电器再次动作将门锁锁闭。此外,程序中还增加了射频卡权限判断的功能,当遇到合法卡时显示卡号,门锁打开,延时10s自动关闭,当遇到非法卡时不显示卡号门锁不开。本系统设计简单、性能优良,具有一定的实用性。

关键词:门禁,射频卡,电控锁,液晶显示,单片机控制

I

Access Control System Design

ABSTRACT

Entrance guard system uses 89C52 single chip microcomputer as control core and periphery add a buzzer control circuit, open the door indicator light circuit, control circuit and control lock LCD display circuit, etc. Entrance guard system mainly by the CPU and reset circuit, the power indicative circuit, work instructions circuit, oscillating circuit, a buzzer circuit, door control circuit, go out and lock button reading card module, display module. The entrance guard system uses rf card complete charge take the door, according to credit to go out, and other functions. Its working principle is: when credit, a buzzer rang, such as card to be allowed to access, display module display card number, and at the same time relay action will open the door lock, indicator light, delay after period of time relay action will again only door lock, lights go out. When the press out button, the relay action will open the door lock, indicator light, delay after period of time relay action will again only door lock, lights go out. When the input password, if you input the correct, relay action will open the door lock, indicator light, delay after period of time relay action will lock door lock again. In addition, the program will also increase the rf card authority judgment function, when facing legal card showed the card number, door open, delay 10 s automatically shut off, when meeting the illegal CARDS don't show the card number locks don't open. The system is simple in design, good performance, and has practical value!

KEY WORDS: Access Control, Radio Frequency Card, Electronically Controlled Lock, LCD,MCU

II

目 录

基于单片机的门禁系统的设计 ........................ 错误!未定义书签。 前 言 .................................................................................................. 1 第1章 概述 ...................................................................................... 2

1.1 系统方案的比较 ................................................................... 2

1.1.1 选题论证 ..................................................................... 2 1.1.2 方案选择 ..................................................................... 2 1.1.3 CPU的选择 ................................................................. 3 1.1.4 射频卡的选择 ............................................................. 4 1.1.5 液晶显示的选择 ......................................................... 4

第2章 硬件电路的设计 ................................................................... 5

2.1 电路原理 ............................................................................... 5

2.1.1 门禁系统主要组成 ..................................................... 5 2.1.2 门禁系统工作原理 ..................................................... 5 2.2 资源分配 ............................................................................... 6 2.3 最小系统设计 ....................................................................... 6

2.3.1 89C52的简述 .............................................................. 6 2.4 最小系统的设计 ................................................................... 8 第3章 硬件电路原理 ..................................................................... 10

3.1 门控锁电路 ......................................................................... 10 3.2 蜂鸣器电路 ......................................................................... 10 3.3 控制指示灯 ......................................................................... 11 3.4 4×4矩阵键盘 ...................................................................... 11 3.5 读卡模块 ............................................................................. 12 3.6 显示模块 ............................................................................. 14

3.6.1 LCD1602 主要技术参数 ........................................... 14 3.6.2引脚功能说明 ............................................................ 14 3.6.3 1602指令集 ............................................................... 16 3.6.4 与HD44780相兼容的芯片时序表 .......................... 17

III

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4