Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ MFC VC++
Hello Everyone,

I am trying to develop a program for sending a file through Serial port and read the same back. Here what i am doing is 1st sending the complete file through Serial Port and after that m reading it back. but if m sending large file then it creates a problem. I want to continuously fire the file and read the same back continuously and this is possible by using threads but i have never used it before. Can anyone pls help me with the Same?
 
If someone is not able to understand what m trying to do ask then do let me know>
Posted 4-Oct-12 23:32pm
Comments
Jochen Arndt at 5-Oct-12 5:02am
   
See this question http://www.codeproject.com/Questions/470848/Serial-Communication-issue I have just answered. The code snippets may be helpful for you to read data from a serial port using a worker thread.
Sergey Alexandrovich Kryukov at 5-Oct-12 19:35pm
   
Not clear what's the problem. Of course, use a separate thread; one thread for port is usually enough (and more than one per port can easily create problems if you are not extremely careful). You did not provide exact protocol to tell you something concrete, but it should not be a problem. Unfortunately, it's impossible to describe all the aspects of multithreading you can possibly face in one simple answer. Please read on threading and try to implement it by yourself (perhaps, not your task at first but some simple skeleton prototypes). It's not extremely difficult; most applications these days are multithreading. As it looks like you work in the field of control systems or data acquisition; and in this field there is simply nothing to do without multithreading. If you face problem -- ask a qustion; we will gladly help you.
--SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Please see my comments to the question. And start, for example, here:
http://msdn.microsoft.com/en-us/library/975t8ks0%28v=vs.110%29.aspx[^].
 
And don't even play with the idea of serial (or any other) communication applications without multithreading. Same thing is you need to do SCADA, data acquisition, control systems, networking, and a lot more. It looks like the time to start for you is now!
 
The best of luck for you,
—SA
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 7,105
1 DamithSL 5,079
2 Maciej Los 4,866
3 Sergey Alexandrovich Kryukov 4,617
4 Kornfeld Eliyahu Peter 4,384


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 5 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100