第三章 Modbus 通信协议 10 Modbus 协议简介 10 Modbus 协议中两种传输方式的帧格式 11 传输方式 11 RTU模式中每个字节的格式 11 Modbus协议报文RTU帧 11 地址域设置 12 功能域 12 数据域 14 RTU差错校验域 14 CRC校验域的次序 14 选择CRC生成器多项式 14 Modbus通信协议CRC算法 15 CRC表的生成 15 PC机上实现Modbus通信的方法 18 第四章智能仪表——PMM2000系列 19 PMM2000智能仪表硬件总体设计 20 PMM2000智能仪表数据通信规约 20 20 21 第五章 Visual C++的软件界面设计 23 Visual C++编程工具 23 Visual C++ 23 Visual C++中MFC编程环境简介 24 MFC的对话框应用 25 MFC中控件的应用 26 通信测试软件与智能仪表的通信 27 27 通信串口初始化流程 27 仪表与软件实现通信的方法 29 m控件的串行通信 30 在单线程中实现自定义的串口通信类 32 35 通信测试软件界面开发过程 36 界面开发 36 参考文献 43 致谢 44 摘要 该毕业设计论文主要介绍了基于Modbus通信协议的在Visual C++,同时介绍了利用Visual C++。 本文简要介绍了常见的的通信方式(如RS232、RS485等)和其基本工作原理,同时本文详细阐述了Modbus通信协议、通信流程和CRC错误校验,进一步以实例的形式对Modbus通信协议和CRC错误校验进行详解。详细介绍了在Visual C++ :利用Visual C++ ,在单线程中用自定义的串口通信类实现串口连接和多线程下用自定义类实现串口连接。简单介绍了Visual C++语言及其开发环境,详细讲述了利用它实现界面设计的过程和步骤。 关键词:智能仪表;Visual C++;人机界面;m;串口通信 ABSTRACT This paper mainly introduces how to design a software by using the environment of Visual C ++ based on munication protocol to test munication between the intelligent instruments the same time,this paper also introduces the use of Visual C++ software to design . This paper briefly introduces mon way munications (such as RS232 and RS485, etc) and the basic working principle, and at the same time this paper expounds the munication protocol, communication process and the CRC error checking also make some examples of munications protocol and CRC error calibration for further explanation. Also it introduces the design principle and design methods o