洛 阳 理 工 学 院
课 程 设 计 报 告
课程名称 单片机原理与应用 设计题目 基于STC89C52单片机的实验平台开发设计 专 业 计算机科学与技术 班 级 B110501 学 号 B11050108 姓 名 王刚 完成日期 2013/6/20
课 程 设 计 任 务 书 设计题目: 基于51系列单片机的实验平台开发设计 设计内容与要求: 一、设计内容 利用STC系列单片机作为微控制器开发一套软、硬件相结合的单片机实验平台,主要包括以下内容: 1. 电路原理图设计,主要包括集LCD显示模块、串口通信模块、数码管显示模块、LED发光二极管、键盘等接口电路的设计; 2. 学习集成电路等芯片的焊接方法与技巧,进行实际元器件的识别,进行电路板焊接; 3. 在Keil C环境下,进行软件设计。主要包括流水灯、计数器、定时器、LCD字符显示、键盘的控制等功能程序设计; 4. 针对所开发的实验板,结合器件选择、原理图设计、硬件焊接、软件编程调试、软硬件联调等方面写出课程设计报告。 二、设计要求 1. 完成综合实验平台的电路结构分析,进行模块分解,掌握各部分电路的工作原理; 2. 独立完成电路板的焊接,掌握故障排除方法,完成实验平台的硬件设计及开发; 3. 结合Keil C软件在焊接无误的单片机实验平台上开发出流水灯、LCD显示模块,通信模块等程序设计; 4. 按照要求撰写课程设计论文。 指导教师: 舒云星、李传锋 2012年 12 月 20 日 课 程 设 计 评 语 成绩: 指导教师:_______________ 年 月 日
基于51系列单片机的实验平台开发设计
摘 要
由于单片机技术在各个领域正得到越来越广泛的应用,许多集成电路生产厂家相继推出了各种类型的单片机,在单片机家族的众多成员中,MCS-51系列单片机以其优越的性能、成熟的技术及高可靠性和高性能价格比,迅速占领了市场,成为国内单片机应用领域中的主流。目前,可用于MCS-51系列单片机开发的产品越来越多,与其配套的各类开发系统、各种软件也日趋完善,因此,可以极方便地利用现有资源,开发出用于不同目的的各类应用系统。
STC51系列单片机开发板是一款功能强大、集成度高、可扩展性强具有成本低、体积小、可靠性高、功能齐全、低功耗设计、操作方便等特点的单片机实验开发系统,并且摆脱了传统单片机开发套件繁琐的方式
本课题设计采用了STC89C52型号的单片机设计一款单片机实验开发系统,并利用Keil软件建立工程文件,编写简单的程序(比如LCD显示器、数码管和流水灯的程序)进行仿真、下载验证,对我们在书本上学到的只是进行验证,
关键词: STC单片机,Keil软件,数码管,流水灯
I
51 series microcontroller comprehensive experimental board
development design
ABSTRACT
As the single chip microcomputer technic is used wider and wider in all areas, many manufactures of integrated circuit have developed all kind of single chip microcomputer one after another. Among the many member of single chip manufactures family, the MCS-51series of single chip microcomputer has quickly gained the market share and become the main stream in the national application area of single chip microcomputer with their exclllent performance, mature thenic, high reliability and high performance. At present, there are more and more products that can be used to develop MCS-51 series single chip microcomputer, and the development systems and softwares matched to them are improved day by day. Therefore, we can conveniently use available resources to develop all linds of application system used for different aims.
STC51 Series MCU development board is a powerful, high integration, scalability, strong low cost, small size, high reliability, full-featured, low-power design, easy to operate and features microcontroller experimental development system and get rid of umberome way of a traditional microcontroller development kit
Design of this project with a STC89C52 models of single-chip design a single-chip experiment development system, and the establishment of the project file, using the Keil software write simple programs (such as LCD monitors, digital tubes and light water program) simulation download validation of ourbooks to school to verify
KEYWORDS: STC microcontroller, Keil, Digital tube, light water
II
目 录
前 言 ................................................................................................................................................... 1 第1章 系统概述 ............................................................................................................................. 2
1.1 设计题目 ............................................................................................................................. 2 1.2 系统设计目的和内容 ......................................................................................................... 2
1.2.1 设计目的 ................................................................................................................. 2 1.2.2 设计内容 ................................................................................................................. 2 1.2.3 设计要求 ................................................................................................................. 2 1.2.4 设计步骤 ................................................................................................................. 2
第2章 整体设计方案 ..................................................................................................................... 3
2.1 开发板整体外观 ................................................................................................................. 3 2.2 整板电路Proteus仿真电路 ............................................................................................... 3 2.3 软件功能描述 ..................................................................................................................... 4 2.4 仿真软件Proteus中的效果图 ........................................................................................... 5 第3章 硬件电路设计 ..................................................................................................................... 6
3.1两位一体共阴数码管 ........................................................................................................... 6
3.1.1 数码管概述 ............................................................................................................. 6 3.1.2 数码管内部结构 ..................................................................................................... 6 3.1.3 两位一体共阴数码管和74LS374锁存器接口电路 ............................................. 7 3.2 LCD1602液晶 .................................................................................................................... 7
3.2.1 LCD1602液晶简介 ................................................................................................ 7 3.2.2 LCD1602液晶引脚介绍 ........................................................................................ 8 3.2.3 LCD1602液晶外围接口电路 ................................................................................ 8 3.3 串口通信 .............................................................................................................................. 9
3.3.1 串口通讯概述 ......................................................................................................... 9 3.3.2 MAX232接口电路 ................................................................................................. 9
第4章 软件设计 ........................................................................................................................... 10
4.1程序整体流程图 ................................................................................................................. 10 4.2程序清单 ............................................................................................................................. 10 第5章 调试及故障分析 ............................................................................................................... 15
5.1 焊接准备阶段元器件测试、电路原理图故障分析 ........................................................ 15 5.2 电路焊接过程中的故障分析 ............................................................................................ 18 5.3 程序编写过程中的故障分析 ............................................................................................ 18 5.4 实物演示效果 .................................................................................................................... 19 结论 ................................................................................................................................................... 20 谢辞 ................................................................................................................................................... 21 参考文献 ........................................................................................................................................... 22
III