摘 要:众所周知,单片机体积小、质量轻、使用简单、价格便宜,性价比高,应用广泛,其中通讯领域尤为突出,实现多单片机之间的通信尤为重要。同时,生活中对于单片机智能总线开关的应用更加普遍,具有防越报警系统的智能小区,智能家居等。本设计由 PC机与多片单片机构成一个系统,该系统通过主从方式来控制,由 PC机作为主机,单片机作为从机,PC机承担控制和监视的作用,从接收主机发送的两种信息:地址信息和数据。当从机接收到主机发送的地址,即刻进入中断系统,将原始地址与接收到的地址进行比较,倘若相等则准备接收数据,不相等则直接退出中断,准备接收下一次主机发送的地址信息。经研究,本系统能够实现基于单片机智能总线开关的设计,当从机连接的开关关闭时,主机显示屏显示的状态为关状态,并且对应的LED灯为熄灭状态,当打开开关时,主机显示屏显示的开关状态为关状态,并且对应的LED灯为点亮状态。智能总线开关的设计使智能家居得到推广且应用更广泛。93067
毕业论文关键词:PC机,单片机,RS-485总线,通信
Abstract:As we all know, microcontrollers have small size, light weight, easy to use, cheap, cost-effective, widely used, especially in the field of communication, the realization of communication between the microcontroller is particularly important。 At the same time, in the life for the monolithic integrated circuit intelligent bus switch application is more widespread, has the anti - alarm system intelligent community, the intelligent home and so on。 This machine is designed by PC and single-chip microcomputer constitute a system, the system is controlled by master-slave mode, by PC as the host computer, microcontroller as the slave machine, PC machine undertakes the control and monitoring function, two kinds of information from the receiving host sends address information and data。 When the host address is sent from the machine to receive immediate access, interrupt system, the original address and receive the address to compare, if equal, ready to receive data, not equal to exit the interrupt, ready to receive the address information of the sending host next time。 Through research, this system can realize the design of intelligent bus switch based on the connection from the machine when the switch closes, the host display state to an off state, and the corresponding LED lights off, when the switch is turned on, the switch state of computer display for the off state, and the corresponding LED lights for the light state。 The design of intelligent bus switch makes the smart home more popular and widely used。
Keywords:PC, microcontroller, RS-485, communication
目 录
1 绪论4
1。1 单片机发展趋势4
1。2 课题研究现状4
2 设计方法和原理6
2。1 设计方案的选择6
2。2 系统工作原理6
2。3 系统总结构框图6
3 硬件电路设计7
3。1 AT89C51单片机7
3。2 RS-48511
3。3 MAX-48513
3。4 主机电路的设计15
3。5 从机电路的设计16
3。6 总电路图18
4 软件电路设计19
4。1 通信协议的设计19
4。2 串行通信19
5 实物展示与简要介绍23
结论27
参考文献28
致谢29
附录A:主机程序清单30
附录B:从机程序清单34
1 绪论
1。1 单片机发展趋势来自优O尔P论R文T网WWw.YoueRw.com 加QQ7520`18766
单片机,顾名思义就是将计算机的主要部分小型化,轻便化,把所有的基本组成部分全部都集中在一小块芯片上。单片机虽小却包含计算机所有的主要部分,主要为CPU、RAM、ROM、串并行的I/O接口、中断系统、定时器计数器、各系统总线等。[1]