Thread: Serial Port Basics

  1. #16
    Registered User
    Join Date
    May 2004
    Posts
    164
    ok, well, I have been playing and having fun with this console app and it works great, now I have hit my next challenge,

    Dialog based app, and running a continous feed from the port to my application.

    So my question, is....

    As a newbie, should I face the fact that I will now need to try and tackle creating a multi-thread app, the main and the one that runs the serial port monitor and returns message to main?

    or

    are there other methods to updating a variable embedded in a dialog of this sort that I can update to screen while the dialog runs other functions?

    so far my attempts have created an endless loop program that gets stuck monitoring the port and never reacts to the dialog window again.

    This is more of an advice request, I know this is a very general question, just want to get an idea of how to direct my research attempts to best fit this next problem, concerned threads may be too deep for me at this point.....

  2. #17
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    The general approach is - to have a thread for the GUI and thread for serial communication (or two separate threads for reading/writing - depending on your needs)

    And then apply some mechanism of the thread communication when the data arrived should be displayed by the GUI thread (for example ThreadSendMessage)
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #18
    Registered User
    Join Date
    May 2004
    Posts
    164
    well cool, time to start reading on that. I appreciate the info. Thanks again for the las example you sent by the way and to bob who sent that really cool code. Both helped alot.

    Time to start learning threads! Thanks everyone. I will do my best to stop this thread, ha ha. Thanks again for all the help-

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. serial port to poll on request
    By infineonintern in forum C++ Programming
    Replies: 2
    Last Post: 06-11-2009, 06:52 AM
  2. Can't Read From Serial Port
    By HalNineThousand in forum Linux Programming
    Replies: 14
    Last Post: 03-20-2008, 05:56 PM
  3. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  4. need guidance to connect to serial port
    By gnychis in forum Linux Programming
    Replies: 1
    Last Post: 06-02-2005, 10:10 AM
  5. DOS, Serial, and Touch Screen
    By jon_nc17 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 01-08-2003, 04:59 PM