登录
首页 » c » 基于C语言的PC机串口收发(重叠方式)

基于C语言的PC机串口收发(重叠方式)

于 2022-03-19 发布 文件大小:2.99 MB
0 162
下载积分: 2 下载次数: 1

代码说明:

1、开发工具:VS2003及以上版本; 2、功能:计算机的串口收发; 3、编程语言:C语言; 4、实现过程:     发送端: step1:CreateFile函数打开串口COM1;设置通信方式为重叠模式; step2:配置串口波特率,定义控制字DCB,对DCB结构体中主要参数,如波特率、数据位数、校验位、停止为数结构参数进行赋值;配置超时,定义结构体变量TIMEOUTS,对TIMEOUTS中的主要参数进行赋值,完成间隔超时和总超时的定义; step3:定义写串口函数UartWrite();完成将用户输入发送到串口的工作; step4:main函数中定义while循环,不断采集用户的输入。 同理,接受端的代码结构如下:     发送端: step1:CreateFile函数打开串口COM1;设置通信方式为重叠模式; step2:配置串口波特率,定义控制字DCB,对DCB结构体中主要参数,如波特率、数据位数、校验位、停止为数结构参数进行赋值;配置超时,定义结构体变量TIMEOUTS,对TIMEOUTS中的主要参数进行赋值,完成间隔超时和总超时的定义; step3:定义写串口函数UartRead();完成将从串口读取数据的工作; step4:main函数中定义while循环,读取串口数据。 5、操作说明: step1:打开serialrev.exe,点击任意键,建立读串口; step2:打开serialtrans.exe,窗口显示“串口创建成功”,然后输入字符,回车,发送数据。 step3:观察serialrev.exe窗口的变化,此时会显示接受到的数据。

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • aCalculator
    一个可以自由转换进制的计算器 八,十,十六,随意转换(a free conversion of 229 calculators 8, 10, 16, the casual change)
    2007-01-21 22:51:17下载
    积分:1
  • 算法竞赛入门经典 第2版
    说明:  本书是《算法艺术与信息学竞赛》的学习指导。所谓学习指导,是告诉读者学什 么,如何学。算法包罗万象,很难在一本书中的篇幅覆盖很多内容的通知对每个知识 点进行细致讲解,因此本书更多的是作为一本导引、工具书、手册或者学习大纲,给 读者以宏观上的学习指导(This book is a study guide for the Competition of Algorithmic Arts and Informatics. The so-called learning guidance is to tell readers what to learn and how to learn. Algorithms are all-inclusive, and it is difficult to explain each knowledge point in detail with a notice covering a lot of content in a book. Therefore, this book is more used as a guide, a reference book, a handbook or a learning outline to give readers macro-learning guidance.)
    2020-06-21 19:20:01下载
    积分:1
  • pinghengzailiushouming
    有关于平衡载流子寿命的Matlab程序,微电子基础实验课程实验内容.(Matlab program for the balance of carrier lifetime, microelectronics basis of experimental course experiment content.)
    2012-05-29 18:47:38下载
    积分:1
  • bp_pid
    神经网络PID控制算法的实现,相比于PID,神经网络PID具有更好的控制效果。(Neural network PID control algorithm, compared to PID, PID neural network has better control effect.)
    2013-10-12 17:44:33下载
    积分:1
  • 2019.02.24 1400W_SEC
    说明:  串口通讯相关的例程,仅供参考,谢谢大家谢谢大家(Serial communication related routines, for reference only)
    2020-01-08 18:32:21下载
    积分:1
  • barber
    理发店的服务过程仿真 一个理发店有两位服务员A和B顾客随机地到达该理发店,每分钟有一个顾客到达和没有顾客到达的概率均是1/2 , 其中60 的顾客理发仅用5分钟,另外40 的顾客用8分钟 . 试对前10分钟的情况进行仿真。(Service process simulation of a barber shop barber shop attendant A and B, there are two customers arrive at the barber shop randomly, every minute a customer arrives and there is no probability that the customer arrives are 1/2, where only 60 of the customers Barber five minutes, another 40 of customers with 8 minutes. trial for the first 10 minutes of the simulation.)
    2014-01-14 14:52:21下载
    积分:1
  • 简易单纯形法
    简易的单纯形法,没有其他的验证function
    2022-07-12 06:27:47下载
    积分:1
  • mpool
    说明:  文件是内存池分析源码,分析内存的高效管理,及它的设计思路(File is the memory pool of source code, analysis and efficient memory management, and its design ideas)
    2011-03-03 08:47:16下载
    积分:1
  • Beginning-Mac-Program
    英文书Beginning Mac OS X Snow Leopard Programming的源码。(Source code of book "Beginning Mac OS X Snow Leopard Programming")
    2014-01-09 20:42:04下载
    积分:1
  • matlab_point
    说明:  此软件可用来计算节点数,也可用来计算一些简单的算法,如果你对数据结构感兴趣,也可以用此软件解决数据结构的很多问题 (software can be used to calculate nodes, but also can be used to calculate some simple algorithm, If you are interested in the data structure can also use this software to solve many data structure problem)
    2006-01-08 17:03:03下载
    积分:1
  • 696516资源总数
  • 106442会员总数
  • 11今日下载