摘 要
单片机应用技术是目前应用最为广泛的一项计算机控制技术,外围电路功能扩展是单片机应用系统开发中的一项重要环节。本文在分析传统的外围电路功能扩展方法的基础上,提出了一种外围电路功能扩展的新方法,即充分利用单片机的资源,在同一芯片上实现多种外围电路功能,建设成为一个专门用来对外围电路功能扩展的通用化设计平。
论文首先阐述了单片机应用系统开发的一些理论知识,随后在分析微机外围电路各种扩展方法的基础上,提出了单片机与PC机串口通信的基本实现方法。之后以设计单片机与PC机串口通信的硬件平台为起点,研究了以MCS-51系列单片机为核心串口通信的软件功能实现及性能分析,并对整个串口通信系统的建立进行了详细的规划设计,给出了单片机与PC机串口通信平台的完整实现。
在单片机应用系统开发中利用外围电路功能的扩展,将大大方便单片机外围电路的配置,简化系统的结构,增强系统的稳定性、适应性,有利于单片机应用系统的标准化设计,提高系统开发的效率。
关键词:单片机;串口通信;MCS-51
Abstract
Single-chip computer application technology is the most widely used computer control technology, a peripheral circuit function extension is an important link in microcomputer application system development. Based on the analysis of the traditional peripheral circuit function, on the basis of extension method, this paper proposes a new method of peripheral circuit function expansion, namely, make full use of the resources of single chip microcomputer, the function for a variety of peripheral circuit on the same chip, become a dedicated to the construction of the generalized design of peripheral circuit function expansion.
Paper first expounds some theories of the development of singlechip application system, then the analysis of all kinds of computer peripheral circuit on the basis of extension method, puts forward the basic realization method of the MCU and PC serial communication. After the single chip microcomputer and PC serial port communication in order to design the hardware platform as a starting point, studies the serial communication with MCS – 51 series microcontroller as the core software functions and performance analysis, and on the system of serial port communication to establish a detailed planning and design, single-chip microcomputer and PC serial communication platform is given full implementation.
In the single chip microcomputer application system development using the expansion of the peripheral circuit function, will greatly facilitate MCU peripheral circuit configuration, simplify the structure of system, enhance the system’s stability, adaptability, is conducive to the standardization of single-chip microcomputer application system design, improve the efficiency of system development.
Keywords:single chip microcomputer; A serial port communication; The MCS
目 录
摘 要…………………………………………………………………………………………………………………….. I
Abstract…………………………………………………………………………………………………………………… II
第1章 绪论…………………………………………………………………………………………………………… 1
1.1 课题背景…………………………………………………………………………………………………… 1
1.2研究意义……………………………………………………………………………………………………. 2
本章小结:……………………………………………………………………………………………………… 2
第2章 系统的设计方案…………………………………………………………………………………………. 3
2.1设计原则及目标…………………………………………………………………………………………. 3
2.1.1单片机的概念…………………………………………………………………………………… 3
2.1.2单片机的基本机构……………………………………………………………………………. 3
2.1.3单片机的应用领域……………………………………………………………………………. 5
2.2系统的硬件设计方案………………………………………………………………………………….. 5
2.2.1串口通信的概念……………………………………………………………………………….. 6
2.2.2串口通信的原理……………………………………………………………………………….. 6
2.2.3 常用的接口方式………………………………………………………………………………. 7
2.3方案的确定………………………………………………………………………………………………… 7
2.3.1通信方式选择…………………………………………………………………………………… 7
2.4系统的总体方案…………………………………………………………………………………………. 8
本章小结:……………………………………………………………………………………………………… 8
第三章 系统的硬件设计…………………………………………………………………………………………. 9
3.1 硬件电路设计……………………………………………………………………………………………. 9
3.2人机交互模块…………………………………………………………………………………………… 10
3.2.1键盘设计………………………………………………………………………………………… 10
3.3通信模块………………………………………………………………………………………………….. 11
3.4复位…………………………………………………………………………………………………………. 11
3.5系统硬件电路原理图………………………………………………………………………………… 11
本章小结:……………………………………………………………………………………………………. 12
第四章 系统的软件设计……………………………………………………………………………………….. 13
4.1单片机系统设计……………………………………………………………………………………….. 13
4.2软件编程的设计和编程语言的选择…………………………………………………………… 14
4.3 PC模块程序设计……………………………………………………………………………………… 14
本章小结:……………………………………………………………………………………………………. 17
5.1 运行调试…………………………………………………………………………………………………. 18
本章小结:……………………………………………………………………………………………………. 19
致 谢………………………………………………………………………………………………………………….. 21
参考文献………………………………………………………………………………………………………………. 22
附录A………………………………………………………………………………………………………………….. 23