Access RS232

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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/archiv...32-Serial-COM-Port_2900_-in-C_2300_-.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>
 
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
 
Christian Havel said:
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 said:
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/archiv...32-Serial-COM-Port_2900_-in-C_2300_-.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>
 
Hi Ben,

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

Ben Voigt said:
Christian Havel said:
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 said:
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/archiv...32-Serial-COM-Port_2900_-in-C_2300_-.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>
 
Christian Havel said:
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 said:
Christian Havel said:
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

:

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/archiv...32-Serial-COM-Port_2900_-in-C_2300_-.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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top