Results 1 to 2 of 2

Thread: readyread for RS232 communication

  1. #1
    Join Date
    May 2010
    Posts
    8
    Qt products
    Qt/Embedded
    Platforms
    Windows

    Question readyread for RS232 communication

    Hi ,

    Is is possible that a readyread signal is emitted on an RS232 port once I send some data to the RS232 port.
    I have connected the signal readyread to a slot, but the slot is not getting invoked once I send data to RS232 port . If I check the obj->bytesavailable() at the receiving port, I am able to get the bytes available, but, once I use the readyread signal, the corresponding slot is not invoked. Is it because the readyread signal is not detected by the receiver ?

    void serialServer::serialServer()
    {



    sp = new QextSerialPort("/dev/ttyS0");

    if(sp->open())
    qDebug("port is open");
    else
    qDebug("port error");

    frame_no = 1;
    us = 31 ; //ASCII for uit seperator is 31
    eot = 4 ; //ACSII for End of transmission

    connect(&this, SIGNAL(readyRead()), &this, SLOT(requestframe()));
    // connect(&this, SIGNAL(bytesWritten(qint64)), &this, SLOT(sendframe(qint64)));
    }

    void serialServer::requestframe()
    {
    QByteArray buffer;
    while(sp->bytesAvailable()==0);
    buffer +=sp->read(sp1->bytesAvailable());

    if(buffer.toInt(&ok,10) == frame_no)
    {
    Load_Data();


    qDebug("++complete++");
    }

    }

    The code segment is attached. serialServer class is inherited from QIODevice. requestframe is declared as a public slot.

    Please help. Thank You

  2. #2
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: readyread for RS232 communication

    Hi,

    I think you have to do
    Qt Code:
    1. ps->setQueryMode(QextSerialBase::EventDriven);
    To copy to clipboard, switch view to plain text mode 
    before you open the port.

    Also, you may have to use the 1.2 alpha version. I believe (but I'm not sure) that the earlier versions don't create a thread to wait for the comport events.

    Best regards,
    Marc

Similar Threads

  1. RS232 communication
    By sattu in forum Qt Programming
    Replies: 4
    Last Post: 24th September 2010, 09:03
  2. Replies: 1
    Last Post: 16th June 2009, 10:09
  3. PenMount DMC9000 rs232 touchscreen Qt/E 4.5
    By mquinteiro in forum Qt for Embedded and Mobile
    Replies: 5
    Last Post: 8th April 2009, 23:14
  4. Replies: 7
    Last Post: 29th August 2008, 11:24
  5. how to write RS232,give me some advice?
    By hiuao in forum Qt Programming
    Replies: 2
    Last Post: 23rd February 2007, 09:33

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.