惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 司徒正美
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
美团技术团队
WordPress大学
WordPress大学
罗磊的独立博客
Last Week in AI
Last Week in AI
人人都是产品经理
人人都是产品经理
爱范儿
爱范儿
MongoDB | Blog
MongoDB | Blog
J
Java Code Geeks
H
Hackread – Cybersecurity News, Data Breaches, AI and More
H
Help Net Security
S
SegmentFault 最新的问题
C
Check Point Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
腾讯CDC
Engineering at Meta
Engineering at Meta
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
D
DataBreaches.Net
雷峰网
雷峰网
GbyAI
GbyAI
宝玉的分享
宝玉的分享

博客园 - OnlyLiu

ZigBee On Windows Mobile-ZigBee模块的设计制作[转] dojo的学习笔记【转】 三五个人十来条枪 如何走出软件作坊成为开发正规军 甘特图(Javascript实现) - SIcon Gantt Chart GPRS开发系列文章 Fully Editable GridView .net中的socket异步通信实现 Window Mobile 常用资源 ListView 使用C#实现WinForm窗体的动画效果 Custom Controls in Visual C# .NET (很详细,还是外国人严谨) C# 实现屏幕键盘 (ScreenKeyboard) Flex delphi播放flash 蒙板 生死不离 [转]孩子,这水不用买 转发一首 《孩子快抓紧妈妈的手》 ------献给在四川大地震中遇难的孩子
SerialPort
OnlyLiu · 2008-05-29 · via 博客园 - OnlyLiu

Serial Communication using C# and Whidbey 

c# 2.0 serial port communication串口编程实例
 使用SerialPort类设计串口通讯程序

About Serial Port (Hardware)

The serial port on your PC is a full-duplex device meaning that it can send and receive data at the same time. In order to be able to do this, it uses separate lines for transmitting and receiving data. Some types of serial devices support only one-way communication, and therefore, use only two wires in the cable - the transmit line and the signal ground.

Data Transfer

In serial communication, a byte of data is transferred through a single wire one bit at a time. The packets contain a start bit, data, and stop bit. Once the start bit has been sent, the transmitter sends the actual data bits. There may either be 5, 6, 7, or 8 data bits, depending on the number you have selected. Both receiver and the transmitter must agree on the number of data bits, as well as the baud rate.

Null Modem

A Null Modem cable simply crosses the receive and transmit lines so that transmit on one end is connected to receive on the other end and vice versa. In addition to transmit and receive, DTR & DSR, as well as RTS & CTS are also crossed in a Null Modem connection.

Here is the pin diagram:

Sample screenshot

As we are not using any handshake, we will use three wire connections in which we will connect pin 2 of one connector to pin 3 of the other. For both the connectors, connect pin 5 (ground) of both the connectors with each other (common ground).

If you want, you can use only one PC as both transmitter and receiver for this communication. Then, just take a DB 9 connector and a small wire, and connect pin no 2 and 3 using the wire that will connect a loop back. That is, whatever you will send, the same data you will be receiving.