PC Review


Reply
Thread Tools Rate Thread

Access RS232

 
 
=?Utf-8?B?Q2hyaXN0aWFuIEhhdmVs?=
Guest
Posts: n/a
 
      14th Nov 2007
Hi,

how can I access the RS-232 hardware interface using C# and .NET2.0 to send
and receive messages to a hardware component?

Christian
 
Reply With Quote
 
 
 
 
Michael Nemtsev [MVP]
Guest
Posts: n/a
 
      14th Nov 2007
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>


 
Reply With Quote
 
=?Utf-8?B?Q2hyaXN0aWFuIEhhdmVs?=
Guest
Posts: n/a
 
      14th Nov 2007
Hi Michael,

thank you.
Can I use this class, when I connect the hardware to a notebook (USB) using
an RS232 to USB - adapter?

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>
>
>
>

 
Reply With Quote
 
Ben Voigt [C++ MVP]
Guest
Posts: n/a
 
      14th Nov 2007

"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>
>>
>>
>>



 
Reply With Quote
 
=?Utf-8?B?Q2hyaXN0aWFuIEhhdmVs?=
Guest
Posts: n/a
 
      15th Nov 2007
Hi Ben,

thank you. Can you tell me another way to communicate with the RS232 using C#?
Christian

"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>
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
Ben Voigt [C++ MVP]
Guest
Posts: n/a
 
      15th Nov 2007

"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>
>> >>
>> >>
>> >>

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Component to access RS232 Q Microsoft VB .NET 4 5th Dec 2005 07:47 AM
Rs232 access under Netcf =?Utf-8?B?Sm9obiBPbGJlcnQ=?= Microsoft Dot NET Compact Framework 3 23rd Nov 2005 05:08 PM
access rs232 port with vba BoBri Microsoft Excel Programming 3 7th Jan 2005 08:18 PM
RS232 access from C# Pohihihi Microsoft C# .NET 4 24th Dec 2004 03:19 AM
RS232 data to Access database - general approach Chris Microsoft Access 8 14th Jul 2004 06:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:29 PM.