Google Answers Logo
View Question
 
Q: Linking two pcs with serial com in VC++ ( No Answer,   3 Comments )
Question  
Subject: Linking two pcs with serial com in VC++
Category: Computers
Asked by: lolo23773-ga
List Price: $60.00
Posted: 02 Jan 2006 15:09 PST
Expires: 01 Feb 2006 15:09 PST
Question ID: 428168
I have read a few books on serial comm and would like to make a
tutorial where I link two pcs with rs232. The pcs are under XP and I
have VC++ 6.0. The goal would be to send ascii caracters and have a
box (appwizard) where to write and read the results + send button. The
different comm parameters would remain in the source code (brate,
parity...). I would like to start from scratch and have a clear,
complete and step-by-step  description of how to do that. Thanks in
advance for those who will answer to that question.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Linking two pcs with serial com in VC++
From: pockybum522-ga on 03 Jan 2006 10:24 PST
 
This isn't the final answer, but it's a step for getting there.

http://www.ontrak.net/mfc.htm
Subject: Re: Linking two pcs with serial com in VC++
From: lolo23773-ga on 06 Jan 2006 07:30 PST
 
Hi pockybum522,

Thanks for the link which is helpful. Now, if I compile that code could i launch
the .exe from DOS or XP? In which OS are those functions
(setcommstate...) usable ? What else need to be done to send ascii
text through a serial link ?
Subject: Re: Linking two pcs with serial com in VC++
From: nickericson-ga on 18 Jan 2006 22:35 PST
 
In windows Xp you can use CreateFile (see MSDN) to open COM/Serial
ports.  Do this on both machines & writing from one will be read on
the other.

I have a quick page that shows how to read from serial port using this
method here:  http://www.luxoncreations.com/tutorials/serial_read/
The formatting of this page is sort of messed up in IE (Firefox works
fine).  If you are using IE let me know and I might be able to change
it up.

Near the top of the document are several links to MSDN docs.

Compile up this program (once you paste it together) and compile.  You
can run this from the IDE (if you have one) or run it from the command
line (DOS).  Then you can use Hyperterminal on the other machine to
test it. Open Hyperterminal (built into XP) and establish a new
connection and type in Hyperterminal - data should appear on your
other machine.

Creating a program to write data is going to be basically the same as reading.

------
Alternative:
With C# (free 1 year trial compiler at MS) you can read/write much
easier than with C++.  See the System.Io.Ports namespace for help on
this.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy