"Christian Havel" <Ch************@discussions.microsoft.comwrote in
message news:E7**********************************@microsof t.com...
Hi Ben,
thank you. Can you tell me another way to communicate with the RS232 using
C#?
Christian
I used C++/CLI to make my own .NET serial port class based on WinAPI
functions such as CreateFile, SetCommState, WaitCommEvent, ReadFileEx,
WriteFileEx. Using those directly from C# would be rather ugly and quite
error prone.
If the MS SerialPort class is sufficient for your needs then use it, I just
happened to want non-blocking event-driven I/O and to use the full device
name for my USB/serial converters, for example one of my ports is named
"\\?\ftdibus#vid_0403+pid_6010+ftq4s2a9b#0000#{86e 0d1e0-8089-11d0-9ce4-08003e301f73}".
Having my own class also will be advantageous someday when I write a mock
serial object for unit testing.
>
"Ben Voigt [C++ MVP]" wrote:
>>
"Christian Havel" <Ch************@discussions.microsoft.comwrote in
message news:98**********************************@microsof t.com...
Hi Michael,
thank you.
Can I use this class, when I connect the hardware to a notebook (USB)
using
an RS232 to USB - adapter?
As long as it provides a virtual comm port (VCP) driver... but I found
the
SerialPort class rather inadequate. For one thing, it doesn't accept all
valid device names, it requires that the name begin with "COM". Since I
get
device names from the Plug-n-Play layer that was no good.
>
Christian
"Michael Nemtsev [MVP]" wrote:
Hello Christian,
There is SerialPort class in .NET 2.0 and some 3rd part libs for this
http://www.activexperts.com/activcomport/howto/vcnet/
you can find some samples there
http://msmvps.com/blogs/coad/archive...300_-.NET.aspx
or on www.codeproject.com
---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high
and
we
miss it, but that it is too low and we reach it" (c) Michelangelo
CHHi,
CH>
CHhow can I access the RS-232 hardware interface using C# and
.NET2.0
CHto send and receive messages to a hardware component?
CH>
CHChristian
CH>