"Christian Havel" <(E-Mail Removed)> wrote in
message news:E7B2512F-91A5-4B84-A8AA-(E-Mail Removed)...
> 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#{86e0d1e0-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" <(E-Mail Removed)> wrote in
>> message news:98086D14-738F-4234-8142-(E-Mail Removed)...
>> > 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
>> >>
>> >>
>> >> CH> Hi,
>> >> CH>
>> >> CH> how can I access the RS-232 hardware interface using C# and
>> >> .NET2.0
>> >> CH> to send and receive messages to a hardware component?
>> >> CH>
>> >> CH> Christian
>> >> CH>
>> >>
>> >>
>> >>
>>
>>
>>