Solved

Multithreaded Serial Port  App

Posted on 2002-07-11
7
369 Views
Last Modified: 2013-11-20
I am trying to write a multi-threaded  and even based serial communciation application.
It will read data from txt file and write to the serial port.The other port will read this data and display it.
Does anyone have any idea how to do it?
0
Comment
Question by:Prash2002
7 Comments
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 7145731
just look at site http://www.codeproject.com , You can find so many socket program samples there....

Good Luck
0
 
LVL 1

Accepted Solution

by:
joakimf earned 34 total points
ID: 7145774
0
 
LVL 4

Assisted Solution

by:mblat
mblat earned 33 total points
ID: 7147578
Good class for serial comm. is here

http://www.naughter.com/serialport.html

Hope it helps..
0
 
LVL 1

Assisted Solution

by:Mazen
Mazen earned 33 total points
ID: 7157445
Hi,
   you can use the Microsoft communications control for sending and receiving data from the serial port.
Your application has to be dialog based.
Go to : project->add to project-> components and controls
open the registered activex controls and select Microsoft communications control to insert it.
A new icon will appears in the controls menu. Add it to your application. Now from class wizard add a control to it(m_comm). To select and open the port write the following code:

m_comm.SetCommPort(1); // or any port
m_comm.SetSettings("4800,n,8,1");  // you can select the baud rate from here
m_comm.SetPortOpen(TRUE);

to send data write the following code:

m_comm.SetOutput(COleVariant(string)); // the output data is in this string

to receive data :
 COleVariant myvar;
myvar = m_comm.GetInput();
CString str(myvar.bstrval);

m_myedit+=str;  // put data in editbox
UpdateData(FASLE);

If you want the data  to appear every time the buffer is full , double click on the icon the you put in you dialog and select ok and place the above code in this method.
Or you can set a timer to get the data in buffer with the above code which i prefer more.

Regards,
Mazen
 
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question