473,386 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

RS232 class

Hi,

Do you know some good RS232C class? There is one in
VB.NET 101 Examples, but I think it is poor.

1.
I can't for e.g. read into my application all data
received. I must tell how many bytes I would like to
read. If I specify too many exception occures, if too
less there are still some data in buffer.

2.
I use a GPS receiver which send data by RS232. Every line
end with codes 10 and 13. I would like to read from RS232
Class one, or more such lines of data. But full lines! I
have noticed that this class gives me what it has -
sometime partial data.
Is it a spoecific thing about RS232 serial transmition or
only of this class?

Thanks.

Przemo
Jul 21 '05 #1
6 7618
> Do you know some good RS232C class? There is one in
VB.NET 101 Examples, but I think it is poor.


My Serial Port FAQ:

..NET 1.0/1.1 has no support for legacy ports (RS-232/COM/LPT).
It will be included in .NET 2.0 (2005)

.NET 2.0 Beta 1 Documentation:
http://lab.msdn.microsoft.com/librar...m_IO_Ports.asp
Serial Support in Whidbey Demo:
http://www.gotdotnet.com/team/clr/bcl/demos/demos.aspx

With 1.0/1.1 you have to use PInvoke or Interop :

First understand the Win32 API as described here (C++):
http://msdn.microsoft.com/library/en...sdn_serial.asp

MSDN article for .NET (mostly C#):
http://msdn.microsoft.com/msdnmag/is...NETSerialComm/

PInvoke samples for C#:
http://www.gotdotnet.com/community/u...ery=SerialPort
http://msdn.microsoft.com/msdnmag/is...NETSerialComm/
http://www.gotdotnet.com/Community/U...7-73e09c4d5890
http://www.gotdotnet.com/community/u...y=SerialStream
http://www.gotdotnet.com/Community/U...e-5413384f0c25

or for VB.NET:
http://support.microsoft.com/?kbid=823179
http://msdn.microsoft.com/library/en...ortinvbnet.asp
http://www.gotdotnet.com/community/u...px?query=rs232
http://www.mentalis.org/classlib/class.php?id=15
http://www.corradocavalli.cjb.net/

or you can use the "Managed Extensions for C++" and write wrappers.
http://msdn.microsoft.com/library/en...MCOverview.asp
http://www.gotdotnet.com/team/cplusplus/
http://msdn.microsoft.com/library/en...rp12192002.asp
on your VS.NET path:
...\VC7\managedextensionsspec.doc
...\VC7\migration_guide.doc
MC++ Sample:
http://www.codeproject.com/managedcpp/howtocomport.asp

or reusing the VB6 MSComm ActiveX is easy, but it has some 'problems' (license)
http://support.microsoft.com/?kbid=318597
http://www.devhood.com/tutorials/tut...utorial_id=320
http://ourworld.compuserve.com/homep...NETCommOCX.htm

for the Compact Framework (Windows CE)
http://msdn.microsoft.com/library/en...l/PISAPICF.asp
http://www.microsoft.com/downloads/d...3-2d3b9cef4aa5
http://ourworld.compuserve.com/homep...r/CFSerial.htm

commercial:
http://www.sax.net/dotnet/communications/
(Community edition in : http://msdn.microsoft.com/vbasic/vbrkit/ )
http://www.winsoft.sk/ncomport.htm
http://www.charonsoftware.com/net/communications/
http://www.scientificcomponent.com/p...roller_net.htm
http://www.aftek-software.com/CommControl.htm
http://www.componentscience.net/Elements/TransPort/
http://franson.biz/serialtools/

for Interop, use newsgroup:
microsoft.public.dotnet.framework.interop





--
Thomas Scheidegger - MVP .NET - 'NETMaster'
http://www.cetus-links.org/oo_dotnet.html - http://dnetmaster.net/
Jul 21 '05 #2
Przemo,

Will you be so kind not to multipost. Now you have three very good answers
one in the newsgroup dotnet.general and two in the newsgroup languages.vb.

However readers of those newsgroup see only one or two.

Use instead of this crossposting, than everybody sees three answers and can
use those. (crossposting sending one message to more newsgroup in one time).

Thanks in advance.

Cor
Jul 21 '05 #3
Really nioce, and I have now like 10 RS232 sample applications, some seem to
work fine, other doesn't really do anything.
Which one is THE RS232-software?

thanks, Pieter

"Thomas Scheidegger [MVP]" <sp************@swissonline.ch> wrote in message
news:OU**************@TK2MSFTNGP15.phx.gbl...
> Do you know some good RS232C class? There is one in
> VB.NET 101 Examples, but I think it is poor.
My Serial Port FAQ:

.NET 1.0/1.1 has no support for legacy ports (RS-232/COM/LPT).
It will be included in .NET 2.0 (2005)

.NET 2.0 Beta 1 Documentation:

http://lab.msdn.microsoft.com/librar...m_IO_Ports.asp Serial Support in Whidbey Demo:
http://www.gotdotnet.com/team/clr/bcl/demos/demos.aspx

With 1.0/1.1 you have to use PInvoke or Interop :

First understand the Win32 API as described here (C++):
http://msdn.microsoft.com/library/en...sdn_serial.asp

MSDN article for .NET (mostly C#):
http://msdn.microsoft.com/msdnmag/is...NETSerialComm/

PInvoke samples for C#:
http://www.gotdotnet.com/community/u...ery=SerialPort http://msdn.microsoft.com/msdnmag/is...NETSerialComm/
http://www.gotdotnet.com/Community/U...7-73e09c4d5890 http://www.gotdotnet.com/community/u...y=SerialStream http://www.gotdotnet.com/Community/U...e-5413384f0c25
or for VB.NET:
http://support.microsoft.com/?kbid=823179
http://msdn.microsoft.com/library/en...ortinvbnet.asp http://www.gotdotnet.com/community/u...px?query=rs232
http://www.mentalis.org/classlib/class.php?id=15
http://www.corradocavalli.cjb.net/

or you can use the "Managed Extensions for C++" and write wrappers.
http://msdn.microsoft.com/library/en...MCOverview.asp
http://www.gotdotnet.com/team/cplusplus/
http://msdn.microsoft.com/library/en...rp12192002.asp on your VS.NET path:
...\VC7\managedextensionsspec.doc
...\VC7\migration_guide.doc
MC++ Sample:
http://www.codeproject.com/managedcpp/howtocomport.asp

or reusing the VB6 MSComm ActiveX is easy, but it has some 'problems' (license) http://support.microsoft.com/?kbid=318597
http://www.devhood.com/tutorials/tut...utorial_id=320
http://ourworld.compuserve.com/homep...NETCommOCX.htm

for the Compact Framework (Windows CE)
http://msdn.microsoft.com/library/en...l/PISAPICF.asp
http://www.microsoft.com/downloads/d...3-2d3b9cef4aa5 http://ourworld.compuserve.com/homep...r/CFSerial.htm

commercial:
http://www.sax.net/dotnet/communications/
(Community edition in : http://msdn.microsoft.com/vbasic/vbrkit/ )
http://www.winsoft.sk/ncomport.htm
http://www.charonsoftware.com/net/communications/
http://www.scientificcomponent.com/p...roller_net.htm
http://www.aftek-software.com/CommControl.htm
http://www.componentscience.net/Elements/TransPort/
http://franson.biz/serialtools/

for Interop, use newsgroup:
microsoft.public.dotnet.framework.interop





--
Thomas Scheidegger - MVP .NET - 'NETMaster'
http://www.cetus-links.org/oo_dotnet.html - http://dnetmaster.net/

Jul 21 '05 #4
I am sorry.
I made a mistake and I know that this is a naughtiness.

Przemo

-----Original Message-----
Przemo,

Will you be so kind not to multipost. Now you have three very good answersone in the newsgroup dotnet.general and two in the newsgroup languages.vb.
However readers of those newsgroup see only one or two.

Use instead of this crossposting, than everybody sees three answers and canuse those. (crossposting sending one message to more newsgroup in one time).
Thanks in advance.

Cor
.

Jul 21 '05 #5
> Really nioce, and I have now like 10 RS232 sample applications, some seem to
work fine, other doesn't really do anything.
yes I know, some even have critical bugs in threading,
buffer handling, timeout handling, overlapped-IO...
Which one is THE RS232-software?

My recommendation:
- understand the basic working of the Win32 COMM APIs.
- learn the basic rules of .NET PInvoke.

For selecting a solution:
it depends on the kind of communication you have to implement.
Sometimes simple code for opening the port and
synchronous ReadFile/WriteFile is all you need.
Or do you want to use COMM-events?
working with threads? asynchronous-IO?
special timeout handling?

There is no single, optimal sample for all this
different requirements.



--
Thomas Scheidegger - MVP .NET - 'NETMaster'
http://www.cetus-links.org/oo_dotnet.html - http://dnetmaster.net/
Jul 21 '05 #6
> > Which one is THE RS232-software?


My recommendation:
- understand the basic working of the Win32 COMM APIs.
- learn the basic rules of .NET PInvoke.

For selecting a solution:
it depends on the kind of communication you have to implement.
Sometimes simple code for opening the port and
synchronous ReadFile/WriteFile is all you need.
Or do you want to use COMM-events?
working with threads? asynchronous-IO?
special timeout handling?

There is no single, optimal sample for all this
different requirements.


I have to do some communications with an SMS-Modem (AT-commands): So jsut
simple Opening, and Read and Write. Events aren't really necessary...

Any tips would be great :-)
Jul 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dan | last post by:
I wnat to see in browser an status from an device connected on rs232 port The java class for read from serial port is: //Serial.java import java.io.*; import java.util.*; import...
0
by: Jason T | last post by:
I've downloaded and installed the '101 Visual Basic and C# Code Samples' from http://www.microsoft.com/downloads/details.aspx?familyid=08e3d5f8-033d-420b-a3b1-3074505c03f3&displaylang=en I have...
6
by: Ken Breit | last post by:
I am using the RS232.vb class to talk to the serial port. The problem I am having is when I try to read if anything is on the comm port. I call the read method, with the number of bytes I am...
3
by: Przemo | last post by:
Hi, Do you know some good RS232C class? There is one in VB.NET 101 Examples, but I think it is poor. 1. I can't for e.g. read into my application all data received. I must tell how many...
8
by: Terry Olsen | last post by:
I'm trying to use the RS232 class that was in the Platform SDK (i think). Has anyone else used this with events successfully? Here's what i've got: ====================== Public WithEvents...
2
by: Mika M | last post by:
Hi! My application uses Rs232-class, which was shipped with "101 VB.NET Samples\Framework - Using the COM Port". I need to sent certain kind of string into peripheral equipment attached to...
13
by: jay.dow | last post by:
I want to write to the pins of an RS232 without using the serial protocol. The use would be every pin could act to complete a circuit in customized hardware. I could use python to communicate...
2
by: KCUK | last post by:
I have created a software to receive data from an equipment through RS232 communication. It is a simple application of the RS232 class. The software does receive strings from the equipment every time...
4
by: Dave Harry | last post by:
I found the RS232 class from MS's 101 VB samples. Writing to the port works fine. (I've got hyperterminal on the other comm port and a crossover cable between COM1 and COM2) The port is opened...
5
by: =?Utf-8?B?Q2hyaXN0aWFuIEhhdmVs?= | last post by:
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
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.