基于51单片机的三层电梯系统设计 - 图文 下载本文

基于51单片机的三层电梯系统设计

专业班级:电子信息科学与技术姓 名:指导教师: 1班 李 强 金国华老师

信息科学技术学院

摘 要

本文设计了一款基于单片机(AT89C51)的三层电梯的模拟控制系统。以51单片机为核心,由7段显示数码管来作为电梯楼层和电梯上下行状态的显示部分,数码管显示“p”则说明电梯运行状态向上,显示“d”则说明电梯运行状态向下。由按键来分别表示电梯内外的各个功能按钮。

本设计主要是利用了单片机:灵活性大、通用性强以及易于实现复杂控制的特点,使系统在达到设计目的的同时显得结构简单,操作方便,容易理解。文中首先是针对设计的目的选择出比较合适的设计方案,并且对AT89C51单片机和7段显示数码管进行了简要介绍,然后将本次设计的硬件电路分为单片机控制模块、显示模块、按键检测模块三个大的模块。在进行了电路的连接之后,根据电路的连接就各个模块分别编写程序再由主程序统一衔接在一起。通过调试运行,所设计的三层电梯系统基本满足设计要求。

关键词:AT89C51单片机;电梯控制;数码显示

I

Abstract

In this paper,we designed a three elevator analog control system which is based on a microcontroller(AT89C51).The microcontroller as the core,and 7-segment digital tube display as the elevator floor and the elevator up and down the line status display section.When the elevator running up the digital display \buttons inside or outside the elevator are represented by buttons. This

design

is

mainly

the

use

of

the

characteristics

of

SCM:flexibility,versatility and easy to implement complex control features.So that the system is not only designed to meet the design requirements but also seem simple structure,easy to operate and understand.First of all,we choose the appropriate design and then a brief description of AT89C51 microcontroller and 7-segment display digital tube.Then in this design the hardware circuit is divided into three large modules:single-chip control module, display module, key detection module .According to the connection of the circuit ,we write programs on each module separately and then together in unity by the main program.By commissioning,the system is basically meet the requirement of the design.

Key word:AT89C51Microcontroller;Elevator control;Digital display

II

目 录

第1章 绪论 ................................................................................................................. 1

1.1 课题的背景及意义 ......................................................................................... 1 1.2 设计的目的要求 ............................................................................................. 1 1.3 方案选择设计 ................................................................................................. 2

1.3.1 按键模块方案选择 ............................................................................... 2 1.3.2 AT89C51单片机控制模块供电方案选择 ........................................... 2 1.3.3 显示模块方案选择 ............................................................................... 2

第2章 电子元件 ......................................................................................................... 4

2.1 AT89C51单片机 ............................................................................................. 4

2.1.1 AT89C51单片机硬件 .......................................................................... 4 2.1.2 AT89C51单片机中断系统 ................................................................. 11 2.1.3 AT89C51单片机定时器/计数器 ....................................................... 13 2.1.4 串行通信 ............................................................................................. 16 2.1.5 AT89C51单片机的发展和未来 ......................................................... 17 2.2 7段显示数码管 ............................................................................................. 18

2.2.1 7段数码管的结构和原理 ................................................................... 18 2.2.2 7段数码管的驱动方法 ....................................................................... 19

第3章 硬件电路设计 ............................................................................................... 21

3.1 AT89C51单片机控制模块 ......................................................................... 21

3.1.1 电源电路 ............................................................................................. 21 3.1.2 复位电路 ............................................................................................. 21 3.1.3 时钟电路 ............................................................................................. 22 3.2 按键模块 ....................................................................................................... 22 3.3 显示模块 ....................................................................................................... 23 第4章 软件程序设计 ............................................................................................... 24

4.1 主程序模块 ................................................................................................... 24 4.2 按键检测模块 ............................................................................................... 25 4.3 显示模块 ....................................................................................................... 25 第5章 仿真及硬件实现 ........................................................................................... 27

5.1 仿真 ............................................................................................................... 27

5.1.1 仿真软件 ............................................................................................. 27

III