Solved

Multithreaded Serial Port  App

Posted on 2002-07-11
7
373 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

632 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