Results 1 to 14 of 14

Thread: read and write in serial port

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2016
    Posts
    81
    Thanks
    31
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: read and write in serial port

    I wrote a .net program.It worked very well likes to Hercules_3-2-6 Application and qt program worked after opening the program.
    Is it bug of Qt 5.5.1 ?

  2. #2
    Join Date
    Jan 2016
    Posts
    81
    Thanks
    31
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: read and write in serial port

    I added this line for handle error port.

    voidMySerialPort::handleError(QSerialPort::SerialP ortErrorerror)
    {
    qDebug()<<"Error:"<<error;//I added this line
    if(error==QSerialPort::ResourceError)
    {
    showStatusMessage(serial->errorString());
    closeSerialPort();
    }
    }

    Result of run program:

    Error: 0
    "Connectedd"
    Error: 6
    "\x00"


    Just sometimes I have error 6.
    How do I fix break condition error?

  3. #3
    Join Date
    Jan 2009
    Location
    Russia
    Posts
    309
    Thanks
    2
    Thanked 43 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: read and write in serial port

    > How do I fix break condition error?

    Nohow. It is HW/driver issue.

    UPD: Future Qt 5.6.0 won't be process the Parity/Frame and BreakCondition errors anymore. So, you can try QtSeriaslPort from 5.6.0 branch.

  4. The following user says thank you to kuzulis for this useful post:

    neda (10th February 2016)

  5. #4
    Join Date
    Jan 2016
    Posts
    81
    Thanks
    31
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: read and write in serial port

    Quote Originally Posted by kuzulis View Post
    > How do I fix break condition error?

    Nohow. It is HW/driver issue.

    UPD: Future Qt 5.6.0 won't be process the Parity/Frame and BreakCondition errors anymore. So, you can try QtSeriaslPort from 5.6.0 branch.
    Of course,My program is problem because other programs (C# .net , Hercules) work very well.
    My problem is bug of QSerialPort?
    Last edited by neda; 10th February 2016 at 09:00.

  6. #5
    Join Date
    Jan 2009
    Location
    Russia
    Posts
    309
    Thanks
    2
    Thanked 43 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: read and write in serial port

    > Of course,My program is problem because other programs (C# .net , Hercules) work very well.

    So what? Maybe they (those programs) do not trace the EV_ERR event flag. This flag coming from the device driver, and QtSerialPort < 5.6 handles this error when it is occurred.

    > My problem is bug of QSerialPort?

    You problem is bug of HW/driver of device.

  7. The following user says thank you to kuzulis for this useful post:

    neda (10th February 2016)

  8. #6
    Join Date
    Jan 2016
    Posts
    81
    Thanks
    31
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: read and write in serial port

    Thanks you very much.
    Your answer was a big help for me.

    serial->setDataTerminalReady(false);

Similar Threads

  1. Serial read misses to read data from the serial port
    By mania in forum Qt for Embedded and Mobile
    Replies: 11
    Last Post: 18th August 2014, 08:49
  2. qext-serial-port write problem.
    By rex in forum Qt Programming
    Replies: 11
    Last Post: 9th December 2013, 07:18
  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

Tags for this Thread

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.