网学网为广大网友收集整理了,基于RS485总线的远程双向数据通信系统的设计,希望对大家有所帮助!
论文编号:JD534 附开题报告,任务书,外文翻译,论文字数:21446,页数:46
摘 要
随着数据通信技术的发展,采用PC 与多台单片机构成的分布式系统、工业控制系统、数据传输系统等越来越受到广泛应用。本课题在国内外已受到非常多的关注与研究,并且不断的得到改进,在实际应用中也取到了较好的效果,具有非常好的应用推广价值。
本课题的主要研究工作是在PC机与单片机的数据通信中采用RS485 总线组建的远程双向数据通信系统的系统结构、硬件设计。因此本文主要介绍了基于RS485总线的远程双向数据通信系统平台构成,描述了上位PC机负责通信(包括与单片机之间的串行通信和数据的远程通信)、数据处理以及用VB6.0建立在Window2000/ XP 环境下的计算机端通信软件和用单片机KeilC51 编写的下位机通信软件等工作。另外,也对本系统所采用的可靠性、抗干扰措施和容错设计作了一些介绍.在本系统中,上位机以PC和Windows操作系统为软、硬件资源;下位机采用ATMEL公司89S52,总线标准采用的是测控系统常用的RS-485。
将该系统运用到宾馆客房环境监测系统中,下位机的温湿度传感器SHT11和烟雾传感器MQ-N5采集数据到数据后,通过此485总线系统能将测量数据(温湿度)传送到PC机上显示,对检测到烟雾起报警作用。试验结果最终表明,该系统整体实现了实时性较好,运行稳定可靠。
关键词:串行通信;RS-485总线;VB6.0; 89S52;远程双向数据通信;
Abstract
With the development of digital communication technology,the distribute-type systems, industrial control systems, data transmission systems,.etc, which adopts PC to constitute with many microcontrollers to be subjected to more and more extensively applied. This topic is continuously having already been subjected to quite a few concern and research at home and abroad, and getting a continuous improvement, also taking better result in physical application, having very nice expansion value.
The main research work of this topic is the system structure, hardware design in the PC and SCM data communications,which is using Long-range two-way data communication system established by RS-485 . So this text mainly introduced the terrace according to the constitute of the Long-range two-way data communication system established by RS-485 ,describing the place of honor PC machine to be responsible for correspondence (including with the line correspondence to scm and data in the long-disdance correspondence), data processing , using VB6.0 builds the computer software and communications - SCM software prepared with KeilC51 in Window2000 / XP environment and so on. Moreover, also making some introduction to the credibility, anti- interference measure and the system-permitted- wrong design .In this system ,the honor PC machine uses PC and Windows operating system for software and hardware resources ; the lower computer adopts 89S51 which is produced by ATMEL Corporation, Bus standard adopts the monitoring system that is commonly used RS-485 .
Make use of that system to the environment monitor of the hotel room in the system, , after the temperature and humidity sensor SHT11 and smoke senstor MQ-N5 of the lower PC collecting the data to the data,can send measurement data(temperature and humidity) to the PC by 485 bus system , it rightly plays an alarm starting role to the process that detects smoke . Final test results show that the system achieved a better real-time, stable and reliable operation as a whole.
Keyword: Serial Communication ; RS-485 bus ;VB6.0; 89S52; Long-range two-way data communication ;
目 录
引言 1
1 绪论 2
1.1 本课题的研究意义 2
1.2 本课题的发展现状以及趋势 2
1.3 本课题的主要研究工作和各章内容安排 2
2 相关技术和基础理论介绍 4
2.1 RS-485总线概述 4
2.1.1 RS-485的接口标准 4
2.1.2 RS-485驱动芯片及应用接口 5
2.1.3 RS-485通信协议及规则 6
2.2 主要器件及应用 7
2.2.1MAX232芯片 7
2.2.2MAX485芯片 9
2.2.3 AT89S52 10
3 系统总体设计 15
3.1 系统要求 15
3.2 通信实施方案的选择 15
4 系统硬件设计 17
4.1PC机通信接口电路设计 17
4.2下位机模块设计 18
4.2.1电源模块 18
4.2.2信号采集模块 19
5 系统软件设计 20
5.1通信原理 20
5.2PC机与多单片机的多机通信原理 20
5.3 通信协议 21
5.3.1信息格式 21
5.3.2定时与重发 22
5.4通信过程 22
5.5程序框图 23
6 上位机软件设计 25
6.1通信控件MSComm简介 25
6.1.1MSComm的属性 25
6.1.2MSComm的事件 25
6.2PC与单片机间通信界面 26
6.2.1正确使用MSComm控件 26
6.2.2通信协议及通信程序代码 27
7 电路布板,调试及故障分析 30
7.1 布板 30
7.2 电路的调试及故障分析 31
7.3 试验结果 31
8 可靠性、抗干扰措施及容错设计 32
8. 1 硬件线路上的考虑 32
8. 2 软件设计上的考虑 32
9总结 33
谢辞 34
参考文献 35
附录:程序 36