By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,317 Members | 1,290 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,317 IT Pros & Developers. It's quick & easy.

Receiving Data through RS232 cable

P: 4
I'm doing a project and want to do a graphical interface using V. Studio 2010. I want to use VB.NET as a programming language.
#Do I have to add any soft ware to define
#What is the function that reads the data from the serial port?
#If I want to receive more than one type of data, and I want to put/read them in separate text boxes, what is the function to filter the incoming data?
Jun 4 '10 #1
Share this Question
Share on Google+
4 Replies

code green
Expert 100+
P: 1,726
Not sure what you mean by define

I did this stuff using VB6, but had to write my own functions. I would be suprised if .NET is any different.
In fact I did the basic I/O port communication via C using a dll because of the limitations with VB
Jun 4 '10 #2

Expert 2.5K+
P: 3,525
The .NET framework has a SerialPort class. And it throws several events. Most commonly you will use the "DataReceivedEvent"

But to ask "what function for reading serial data" and "What function to filter the data" would indicate that you are expecting there to be some set of methods already written to handle your needs. That's just not the case. You will need to take in the data and do the filtering yourself based on your criteria.

The MSDN has a full explanation and sample.
Jun 4 '10 #3

P: 4
Thanks a lot guys for your help.

Is it correct that all data are received as strings ?
When receiving in VB, is it just like printing on the screen or it can be assigned to a variable? Is this an example of that :
Dim message As String =_serialPort.ReadLine()

Sorry for my -low level- questions I'm still a beginner.
Jun 13 '10 #4

code green
Expert 100+
P: 1,726
RS232 I/O communication is strings.
There is an RS232 language which uses simple English words.
Individual instruments that communicate via RS232 may have additional words in their vocabulary.
Whatever you are reading data from, the manufacturer will publish an aide to communication.

Communication starts off with all the handshaking stuff then a signal to notify when data starts and ends.
But I honestly don't know how much of this is handled by the SerialPort class tlhintoq mentions.

I would study the class documentation
Jun 14 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.