登录
首页 » Com Port » 一个简明的串口通讯例子

一个简明的串口通讯例子

于 2022-03-12 发布 文件大小:215.68 kB
0 171
下载积分: 2 下载次数: 1

代码说明:

一个简明的串口通讯例子-a simple and clear example for serial port communication

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

发表评论

0 个回复

  • 从串口读取数据,有两种方法,1、每接收一个EV_RXCHAR,就用ReadFile读一次,这样我觉得太恐怖了。2、接收到一个EV_RXCHAR后,等一定数据量的...
    从串口读取数据,有两种方法,1、每接收一个EV_RXCHAR,就用ReadFile读一次,这样我觉得太恐怖了。2、接收到一个EV_RXCHAR后,等一定数据量的CPU周期(GetTickCount),再一次性读取缓冲区里的数据。这样做,一般情况下不会有问题,但是,如果数据很多,过了“一定数据量的CPU周期”,还没收完数据怎么办?就会少读数据了。 我用三个线程序来完成串口数据的接收,其实就是第一种方法的变种: 一个侦听EV_RXCHAR,一个对EV_RXCHAR进行分析,其实就是超时判断。如果接收到一个消息后,一段时间没收到下一个EV_RXCHAR,就认为是一个数据包的结束。这个线程就会通知数据接收线程,进行数据接收。一般同一包数据,两个字符之间的时间间隔,应该很小了吧,而两个数据包之间的间隔,应该不会太小吧!(这个地方我不清楚,猜的:( :) )最后一个线程,是接收数据的。-read data from the serial port, there are two methods, one, each receiving a EV_RXCHAR, on the ReadFile read, I think this vote. 2, received a EV_RXCHAR after a certain volume of data, such as CPU cycles (GetTickCount), and the one-time reader, the data buffer. To do so, under normal circumstances there is no problem, but if many of the data, and after a "certain amount of data the CPU cycles," also confiscated End Data how do? Few will read the data. I used three lines to complete serial data reception, the first method is a variant : an interception EV_RXCHAR, one pair of EV_RXCHAR analys
    2023-03-23 09:55:03下载
    积分:1
  • 好东东,用C写的,USB接口程序,很好用
    好东东,用C写的,USB接口程序,很好用-Dongdong good with C wrote, USB interface program, a very good use
    2022-06-25 23:39:43下载
    积分:1
  • 串口通信的东东 串口通信的
    串口通信的东东 串口通信的-Dongdong serial communications serial communications serial communications Dongdong
    2022-04-10 15:25:56下载
    积分:1
  • Modbus协议的努力准备与你分享一些厚希望能启发所有
    我用vb编写modbus协议,拿出来与大家分享一下,厚厚,希望得到大家的指教-Modbus protocol prepared hard to share with you some thick hope to enlighten all
    2022-02-01 13:45:51下载
    积分:1
  • The EZ320 utility demonstrates the communication program between host PC and the...
    The EZ320 utility demonstrates the communication program between host PC and the MR320.
    2022-02-14 11:23:32下载
    积分:1
  • This article described in detail in the Win32 environment by calling the communi...
    本文详细地介绍了在Win32环境下通过调用通信API 函数以异步方式来实现PC机和MCS 51 单片机之间的通信过程给出了软硬件设计机理以及详细的通信协议说明-This article described in detail in the Win32 environment by calling the communication API function in order to realize asynchronous approach to PC and MCS 51 Singlechip give the communication process between the design of the mechanism of the hardware and software as well as detailed description of the communication protocol
    2022-03-11 12:25:56下载
    积分:1
  • 用VC实现的串口调试软件
    用VC实现的串口调试软件-with VC serial debugging software
    2023-05-31 16:55:03下载
    积分:1
  • 串口通讯工具,提供了两个串行POR同步监测…
    串口通讯工具,提供两个串口同时监控,发送程序。有ASCII和十六进制两种显示方式,非常方便。
    2022-11-05 18:50:03下载
    积分:1
  • max232 communications driver source
    max232通讯驱动源程序-max232 communications driver source
    2022-02-27 09:03:47下载
    积分:1
  • 此程序可以帮助你在没有串口的单片机上,实现串口功能,用C51编程,有利于移植!...
    此程序可以帮助你在没有串口的单片机上,实现串口功能,用C51编程,有利于移植!-this program can help you in the absence of SCM Serial, Serial function, C51 program is conducive to transplant!
    2022-01-26 19:31:39下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载