【编者按】网学网电子数电单片机频道为大家收集整理了“WIN32环境下对PC机通用串行口通信的研究及实现“提供大家参考,希望对大家有所帮助!
论文编号:JD686 论文字数:19301,页数:51
摘 要
当今世界是一个高度自动化的社会,各式各样的设备都可以和计算机联机,而最简单的自动化联机方式就是使用串行通信。串行通信存在的时间已经不短了,随着科技的发展,它不但没有被取代,其应用反而越来越广。这是因为串行通信设备硬件设备的实现比较简单,而且使用也比较简单
串行通信是计算机之间或计算机与其它硬件通信的一种手段, 被广泛地应用于数据采集、工业监控等领域。由于串行口通信经常被使用, 所以应找到一种可以重复利用的方法, 以方便今后使用。C++ Builder给程序设计人员提供了相当好的开发环境,开发VCL组件也相当简单。通过将用于对串口操作的Windows API 函数封装在我们自己定制的组件中, 可以很方便地对串口进行各种操作, 而且还能在多种编程环境下重复使用。
本次设计将利用C++ Builder平台开发一个VCL组件,用以实现WIN32环境下的串口通信的程序开发。并利用该组件开发一个计算机之间的数据交换界面,实现基本的数据交换。
关键词:串行通信;C++ Builder;组件;API函数;WIN32
Abstract
Nowadays the society that world is a to automate highly, various equipments can and the calculator machine, but the most simple automation machine method is to use the string to go the correspondence. The string goes to correspond by letter existent time already not short, along with the development of science and technology, it did not is replace not only, it is applied on the contrary and more and more widely. This is because a realization that goes to correspond by letter the equipments hardware equipments is more and in brief, and the usage is also more simple
The string go the correspondence is a calculator occasionally calculator and other hard wares correspondence of a kind of means, is been apply in the data to collect broadly, the industry supervision etc. realm. The string goes a people''s correspondence to usually be used for, so should find out a kind of method that can repeat the exploitation, using from now on with the convenience. C++ the Builder gave the program design the personnel provide the fairly good development environment, the development VCL module is also very simple. Pass will used for to operate to the an of the function of Windows API seal to pack in the module that we makes to order by ourselves, can carry on various operation to the a very expediently, and return the ability to use again under various plaits distance environment.
A design will make use of the C++ Builder the terrace of Builder develops a VCL module, carrying out the environment of WIN32 in order to under of the a development that corresponds by letter the procedure. Make use of the data of for that module to develop a calculator to exchange the interface also, carry out the basic data commutation.
Keyword:Serial Communication;C++ Builder;Module;Function of API
目 录
摘要……………………………………………………………………………… Ⅰ
Abstract………………………………………………………………………… Ⅱ
绪论……………………………………………………………………………… 1
第一章 基本概念……………………………………………………………… 3
1.1 通信…………………………………………………………………… 3
1.1.1 数据发送……………………………………………………… 3
1.1.2 通信的种类…………………………………………………… 4
1.2 串行通信……………………………………………………………… 4
1.2.1 RS-232串行通信……………………………………………… 4
1.2.2 RS-232C及其电气特性 ……………………………………… 5
1.2.3 远距离通信…………………………………………………… 7
1.2.4 近距离通信…………………………………………………… 8
1.2.5 串口通信的其他问题………………………………………… 8
第二章 WIN32下的操作系统概述………………………………………… 12
第三章 串行通信程序及组组件建立………………………………………… 14
3.1 用于串行通信的WIN32 API简述…………………………………… 14
3.1.1串行通信相关函数…………………………………………… 14
3.1.2使用流程……………………………………………………… 16
3.2 串行通信中的字符与字节…………………………………………… 17
3.2.1字符和字节的差别…………………………………………… 17
3.2.2 C++ Builder中的字符串…………………………………… 17
3.3 串行通信组件的创建………………………………………………… 17
3.3.1可视组件库 …………………………………………………… 18
3.3.2 组件和类……………………………………………………… 18
3.3.3 创建不可视组件……………………………………………… 19
3.4 通过串行通信组件创建传输界面…………………………………… 25
3.4.1界面设计……………………………………………………… 25
3.4.2功能设计……………………………………………………… 25
结论……………………………………………………………………………… 27
致谢……………………………………………………………………………… 28
参考文献………………………………………………………………………… 29
附录……………………………………………………………………………… 30
附录1……………………………………………………………………… 30
附录2……………………………………………………………………… 45