串口通讯

Serial library for C++

Introduction

Serial communications is needed in several types of applications, but the Win32 API isn't a very easy to use API to implement it. Things get even more complicated when you want to use serial communication in an MFC based program. The classes provided in the library try to make life a little easier. Its documentation is extensive, because I want to give you a good background. Serial communication is hard and good knowledge of its implementation saves you a lot of work, both now and in the future...


http://www.codeproject.com/KB/system/serial.aspx



Serial Communication in Windows

Introduction

This article is meant to give you a jump start on doing serial communicationin Windows (NT family). The article will provide a class calledCSerialCommHelper which you can use directly to do serial communication in yourapplication. The class that is provided here with this article does usesoverlapped IO. You donot need to know much about serial communication oroverlapped IO for this article. However, you need to know some about thesynchronization objects like Events and some Windows APIs likeWaitForSingleObject and WaitForMultipleObject etc. Also some basic understandingof windows threads is required - like thread creation and termination.

Introduction

In order for your computer to be able to do serial communication, computerhas to have a serial port. Most of the computers have at least one serial portalso known as COM port ( communication port ) and are generally called COM1 COM2etc. Then there are the device drivers for the serial ports. If you think itover, all you that you need to do in serial communication is either send data orreceive data. In other words, you are doing input/output (IO) to the serialport. The same IO is done with disk based files. Hence there is no surprise thatthe APIs for reading and writing to a file apply to serial ports as well. Whenyou send data to the serial port its in terms of bytes but when it leaves theserial port it is in the form of bits. Similarly, when the data arrives at theserial port, its in bit format and when you get data you get it in bytes.

http://www.codeproject.com/KB/system/serial_com.aspx

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值