电子与信息工程毕业论文:单片机双机通信系统设计.doc
《电子与信息工程毕业论文:单片机双机通信系统设计.doc》由会员分享,可在线阅读,更多相关《电子与信息工程毕业论文:单片机双机通信系统设计.doc(35页珍藏版)》请在温州文客信息科技有限公司上搜索。
1、 本 科 毕 业 设 计 单片机双机通信系统设计 所在学院 专业班级 电子与信息工程 学生姓名 学号 指导教师 职称 完成日期 年 月 I 摘要 在智能控制领域里,单个的单片机往往不能满足全部的工作要求,通常需要两个或多个单片机协同工作。本文主要阐述双机通信的原理,包括串行通信 的类型,通信协议的实现,以及双机通信的电路连接方案。同时介绍软硬件方案的设计,以及系统仿真和代码烧写。整个系统包括作为输入的矩阵键盘,两块单片机之间的电路连接和作为输出的数码管显示电路。 单片机串行通信是单片机的一个重要应用,串行通信用一根传输线按位传送数据,每传送一个数据或字符都符合一定的格式。在硬件设计中,通过对双
2、机通信方案的比较,最终选择异步串行通信方式。异步串行通信只需单片机 P3 口两个引脚之间交叉连接,并对相关特殊功能寄存器进行初始化,完成以上操作后就能进行双机通信。在软件设计前,对编程软件KEIL 如何建立工程及相应操作进行研究,这样对于后面实现双机通信帮助很大。将通信系统分为发送端和接收端两部分,发送端采用查询方式进行数据传输,为有效利用 CPU 接收端采用中断方式。完成软硬件设计后,再编译链接生成单片机能够识别的机器语言,为功能验证做好准备。 在系统功能验证时,首先用 PROTEUS 软件设计电路并仿真成功,再应用 PROTEL 软件设计硬件电路及 PCB 电路图,同时对双机通信系统的功能
3、进行调试。 本次设计成功完成单片机双机通信系统的设计,即实现发送端单片机将外部键盘输入的内容发送到接收端,同时双机外扩数码管同时 显示发送对象,而且通信波特率可以调整。 关键词: 串行通信;单片机;数码管II Abstract In the field of intelligent control, separate SCM systems are often unable to meet all the requirements for the work, usually requires two or more SCM work. This article focuses on the p
4、rinciple of double-machine communication, including the type of serial communication, communication protocol implementation, and communication double circuit connection scheme. I also introduced the design of hardware and software solutions, and system simulation and code programming. The system inc
5、ludes a matrix keyboard as an input, the circuit connection between two microcontrollers and digital display as an output circuit. Serial communication is an important application of the microcontroller, serial communication with a transmission line to transmit data by bit, each character is transmi
6、tted or a data line with a certain format. In the hardware design, through the comparison of dual-communication scheme, I final choice asynchronous serial communication. Asynchronous serial communication between the microcontroller only cross-connect, and special function registers related to initia
7、lize all the above operations can be carried out after the two-machine communication. In the software design prior to programming software KEIL on how to build understanding of engineering and other operations, so that the back to achieve double for very helpful communications. Sending the communica
8、tion system is divided into two parts and receiver communicate using query mode transmitter for data transmission, the receiver efficiency for effective utilization of CPU by interrupt. After completion of hardware and software design, build link in the microcontroller generates the machine language
9、 to identify, prepare for the functional verification. When verifying the systems function, we design the first circuit and software with the PROTEUS simulation, application hardware and software design PROTEL PCB circuit, while two-machine communication system functions for debugging. The design su
10、ccessful completion of two-machine communication system microcontroller, microcontroller will be sending that to achieve an external keyboard input is sent to the receiver, while dual-expanding digital outside the function keys at the same time show the same time, communication baud rate. key word:
11、serial communication; Microcontroller; LEDIII 目录 前言 . 1 第 1 章 总体方案的设计 . 1 1.1 系统功能要求 . 1 1.2 方案设计比较 . 1 1.2.1 双机并行通信方案 . 1 1.2.2 双机串 行通信方案 . 2 1.3 系统总体框图 . 3 第 2 章 系统硬件设计 . 4 2.1 常用串行扩展总线 . 4 2.1.1 I2C 总线 . 4 2.1.2 SPI 总线 . 4 2.2STC89C52RC 单片机介绍 . 5 2.3 所用特殊功能寄存器的说明 . 6 2.3.1 串行接口控制寄存器 . 6 2.3.2 串行接
12、口工作方式 . 7 2.3.3 定时器寄存器及其工作方式 . 8 2.3.4 波特率的计算 . 9 2.4 矩阵键盘输入电路的设计 . 9 2.5 数码管显示电路的设计 . 10 2.6 双机串口通信电路的设计 .11 第 3 章系统软件设计 . 12 3.1 编程软件 KEIL 的介绍 . 12 3.2 程序流程图 . 13 3.3 矩阵键盘代码 . 14 3.4 数码管显示代码 . 15 3.5 双机串口通信代码 . 15 3.5.1 发送部分代码 . 15 3.5.2 接收部分代码 . 16 IV 第 4 章系统仿真与代码烧写 . 17 4.1 系统仿真 . 17 4.2 代码烧写 .
13、18 小结 . 20 致谢 . 错误 !未定义书签。 参考文献 . 21 附录 1 电路系统总体图 . 21 附录 2PCB 板示意图 . 23 附录 3 实物图 . 24 附录 4 代码 . 25 1 前言 随着计算机技术的快速发展和广泛应用,从智能家用电器到工业上的集散控制系统( DCS)都采用了上位机与下位机基于串行通信的主从工作方式,这样就充分结合利用了微型计算机分析处理能力强 、速度快的特点及下位机面向控制、使用灵活方便的优势。 51 系列的单片机 1-6内部包含有 数据存储器 、 程序存储器 、两个 16 位的定时器 /计数器、通用异步串行 收发器这些 资源。 在广泛的应用中,单独
14、一片单片机所能完成的任务是有限的,因此而常常需要扩充 I/O 接口、定时器 /计数器、串行通信接口、 存储器 。一个系统中使用两个或两个以上的单片机 时 ,单片机之间就 需 要通过互连来进行数据通信。 51 系列的单片机带有串口,利用串口进行互连通信极为方便,并且可以减少端口数量。但如果系统要求扩充的资源是对外连接的串口,串行口上可以外接串行 输入并行输出的移位寄存器 74LS164,或外接并行输入串行输出的移位寄存器 74LS165。为了增加通信距离,减少通道中电源干扰,可以在通信上路采取光电隔离的方法,进行双机串行通信。 双机通信系统设计中, 单片机内部的串行接口是全双工的,它在接收数据的
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
20 文钱
下载 | 加入VIP,畅享折扣下载 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 电子 信息 工程 毕业论文 单片机 双机 通信 系统 设计

链接地址:https://www.wenke99.com/p-338252.html