Results 1 to 11 of 11

Thread: how to i synchronize serial read and write without using thread?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2013
    Posts
    11
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to i synchronize serial read and write without using thread?

    I have replaced the while loops with if, but what i observe is the code will now never read the input register. It just skips that part. Also the readyRead signal is not fired at all when i send data using my virtual serial(realterm). I think i am confused between my own stuffs.
    Ok, i'll explain the total motive of my project.
    what i have to do is:
    Write to serialport when buttons are clicked. Also write to serialport continuously every few seconds and receive their response, intrepret it and display in my gui. It seems like i dont get any response. or there's something else wrong. do my readyRead and timer signals interfere with each other?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: how to i synchronize serial read and write without using thread?

    The condition is probably the wrong way around. Try
    Qt Code:
    1. if(modbus_master.CheckBusy()) return;
    To copy to clipboard, switch view to plain text mode 

    Not sure why you need that at all, the class seems to be using an event driven I/O (QExtSerialPort) so there should be signals when it becomes read for whatever you are checking.

    Cheers,
    _

  3. #3
    Join Date
    Dec 2013
    Posts
    11
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to i synchronize serial read and write without using thread?

    I remove that part completely, it just works fine. Thanks.

Similar Threads

  1. qext-serial-port write problem.
    By rex in forum Qt Programming
    Replies: 11
    Last Post: 9th December 2013, 07:18
  2. Replies: 2
    Last Post: 2nd November 2010, 05:15
  3. Replies: 4
    Last Post: 10th July 2010, 17:34
  4. Replies: 1
    Last Post: 16th June 2009, 09:09
  5. How to write bytes read from serial port to a QFile
    By shamik in forum Qt Programming
    Replies: 19
    Last Post: 25th June 2007, 14:12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.