文件名称:SerialPort
介绍说明--下载内容均来自于网络,请自行研究使用
* 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