top | item 311175

Serial Port Communication in C#

10 points| ionela | 17 years ago |dev.emcelettronica.com | reply

7 comments

order
[+] ajross|17 years ago|reply
I'll never understand the mindset behind windows developers that says: "When starting a project to do some simple low-level task, first throw up a uselessly simple GUI application and put a button on it." I mean, half of this article is about how to use the GUI wizard, just to show off about 10 lines of code.

Beyond that, it's reasonably instructive. I'm happy to know that RS-232 isn't forgotten in the .NET world; there is lots of legacy hardware out with important things to say.

Although I was amused by this bit of hubris in the API design:

  serialPort1.StopBits= StopBits.One;
I'd be curious to hear why the designer felt that the concept of a "stop bit" was so important or complicated that it deserved its own abstraction for the number one. :)
[+] ivankirigin|17 years ago|reply
For any low-lever hardware engineers, I can highly recommend using Python. The struct module is by far the easiest way to send and interpret exact bits along a wire.
[+] revolvingcur|17 years ago|reply
Before you criticize this article as simplistic or unnecessary (arguments about interest to this audience aside), consider that .NET 1.1 didn't have built-in serial port communication. Having spent many hours hacking serial comm in C#, I can say that this would have been a welcome resource, even given its brevity.
[+] ionela|17 years ago|reply
The serial port is a serial communication interface through which information transfers in or out one bit at a time.
[+] prospero|17 years ago|reply
C# is a Java-like language that uses the .NET runtime. Unlike Java, it has first-class functions.

A dog is a four-legged animal that goes woof.

A cow is like a dog, but it's larger, and goes moooooo.