1、 基于基于 C+的的 RS232 通信通信 协议模拟终端协议模拟终端 Analog Terminal For RS232 Communication Protocol Based On C+ 学 院: 专 业 班 级: 学 号: 学 生 姓 名: 指 导 教 师: 2013 年 06 月 密级: 公开 I 摘 要 随着科技的迅猛发展,通信技术已经成为社会经济、环境、生活、工作、学习不可 缺少的一部分。通信的方式多种多样,以何种方式实现通信主要取决于通信设备。在工 业控制系统和实验室中,由于串行通信具有实现简单、使用灵活方便等优点,串行通信 是计算机与外部设备进行数据通信时经常使用的方式之一。
2、围绕串行通信技术,本文主要介绍了串行通信接口RS232 标准串口,阐述了 RS232 串行通信基本原理和 CRC 校验,通过 VC 界面编程实现串行通信。传输过程中 通过 CRC 对数据进行校验。 在研究 RS232 串行通信原理中,主要介绍了 RS232 标准协议、串口以及串口通信 原理。详细的分析了几种主要的通信参数。按照其工作原理及 RS232 串口的标准协议最 终采用串行全双工的方式实现其通信,本文中的接口使用的是计算机上的 USB 口。 在软件实现方面,本设计在比较了多种方法之后,最终选择了基于 C+的 MFC 应 用程序。 利用 MSComm ActiveX 串行通信控件来实现串行
3、通信。 文中详细地介绍了 VC 下的 Windows 平台先进的 ActiveX 控件技术,即 MSComm 控件等。最终实现了两台 PC 间的串行通信。 串行通信以其成本低、结构简单等优点被人们广泛应用。用 RS-232 协议实现两台 PC 机间的串行通信为以后实现更加复杂的设备间通信奠定了基础。 关键词:关键词:RS232 标准标准;串行通信;串行通信;C+;CRC 校验校验 II Abstract With the rapid development of science and technology, communication technology has become an ind
4、ispensable part of social economy, environment, living and learning. There are many kinds of communication modes. The selection of communication mode mainly depends on the communication equipment. In industrial control systems and laboratory, serial communication is widely used in computer and exter
5、nal equipment due to the simple and flexible advantage. Around serial communication technology, this paper mainly introduces the serial communication interface - RS232 serial port, and expounds the basic principle of RS232 serial communication and CRC check .It is completed to realize serial communi
6、cation by VC programming. It can check the data during the process of transmission through the CRC. In the study of RS232 serial communication principle, this design mainly introduces the principle of serial communication, serial port and RS232 protocol,and analyzes communication parameters in detail. Considering RS232 serial port and working principle, this design adopts serial full-duplex mode to realize communication. In the article, the interface is the USB port on the PC