文件名称:SerialPort
-
所属分类:
- 标签属性:
- 上传时间:2014-04-25
-
文件大小:6.74kb
-
已下载:1次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
* Function: 串口的打开、关闭、数据发送 以及 自动接收
(1)采用【事件驱动】的方式,即当缓冲区接收到数据的时候,【自动执行接收数据】,有效的节省系统资源,提高执行效率。
原理:建立一个事件线程,它监视串口的事件和错误信息。当有事件或错误发生时,它主动向【主线程】发送一个Windows消息。主线程在消息相应函数中处理已发生的事件或错误。
(2)采用“异步方式”读串口,耗时的读数据在单独的线程中进行。
(3)编程步骤:定义全局变量、创建串口、开启事件线程、发送数据、自定义消息、关闭串口和关闭线程。同时,另外加配置串口函数,查询可用端口-* Function: Serial to open, close, data transmission and automatic reception (1)] using [event-driven approach, that is, when the buffer receives the data, receive data] [automatically perform effectively conserve system resources and improve the implementation of efficiency. Principle: Create an event thread that monitors serial event and error messages. When there is an event or an error occurs, it is the main thread] [the initiative to send a Windows message. The main thread to handle events or errors have occurred in the message corresponding function. (2) the use of " asynchronous" read serial, time-consuming to read data in a separate thread. (3) programming steps: define global variables, create serial port, open the event thread, send data, custom messages, close the serial port and close the thread. Meanwhile, additionally configure the serial port function, check available ports
(1)采用【事件驱动】的方式,即当缓冲区接收到数据的时候,【自动执行接收数据】,有效的节省系统资源,提高执行效率。
原理:建立一个事件线程,它监视串口的事件和错误信息。当有事件或错误发生时,它主动向【主线程】发送一个Windows消息。主线程在消息相应函数中处理已发生的事件或错误。
(2)采用“异步方式”读串口,耗时的读数据在单独的线程中进行。
(3)编程步骤:定义全局变量、创建串口、开启事件线程、发送数据、自定义消息、关闭串口和关闭线程。同时,另外加配置串口函数,查询可用端口-* Function: Serial to open, close, data transmission and automatic reception (1)] using [event-driven approach, that is, when the buffer receives the data, receive data] [automatically perform effectively conserve system resources and improve the implementation of efficiency. Principle: Create an event thread that monitors serial event and error messages. When there is an event or an error occurs, it is the main thread] [the initiative to send a Windows message. The main thread to handle events or errors have occurred in the message corresponding function. (2) the use of " asynchronous" read serial, time-consuming to read data in a separate thread. (3) programming steps: define global variables, create serial port, open the event thread, send data, custom messages, close the serial port and close the thread. Meanwhile, additionally configure the serial port function, check available ports
(系统自动生成,下载前可以参看下载内容)
下载文件列表
SerialPort.cpp
SerialPort.h
SerialPort使用详解.txt
SerialPort.h
SerialPort使用详解.txt
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.