Results 1 to 20 of 22

Thread: Number of bytes receives not the same after each cycle

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2014
    Posts
    26
    Thanks
    26
    Qt products
    Qt4
    Platforms
    Unix/X11

    Smile Number of bytes receives not the same after each cycle

    Hi,

    I want to receive 9 bytes after each cycle
    Im using the QSerialPort to comunicate between a reaspberry pi and an other device (microcontroller)

    I write a code

    I have perfectly 9 bytes after each cycle but not in the same QbyteArray :

    for example :

    nb data read = 9 bytes = "011109101809090913"
    nb data read = 8 bytes = "0209091018090909"
    nb data read = 1 bytes = "13"
    nb data read = 8 bytes = "0309091018090908"
    nb data read = 1 bytes = "13"
    nb data read = 9 bytes = "04110910170909090f"
    nb data read = 9 bytes = "050909101809090913"
    nb data read = 9 bytes = "061509101809090813"
    nb data read = 8 bytes = "0711091018080909"
    nb data read = 10 bytes = "1308110910170908090f"

    I want to receive exaclty 9 bytes :

    If u see the example , you can remark that each byte have an ID(1,2,3....) and 8 other bytes
    and when i have 8 bytes, the next byte is the end of the later (8 bytes) ..

    i have this code

    Qt Code:
    1. StopAff->setEnabled(true);
    2. QByteArray bytes;
    3. bytes = PortReception->readAll();
    4. qDebug() <<"nb data read = " << bytes.size() << " bytes = "<< bytes.toHex();
    To copy to clipboard, switch view to plain text mode 

    How I can resolve the problem
    Last edited by AUDI_ENG; 4th July 2014 at 14:41.

Similar Threads

  1. Replies: 4
    Last Post: 23rd October 2012, 08:40
  2. Qt EventLoop Duty Cycle (Blocking vs Spinning)
    By bob2oneil in forum Qt Programming
    Replies: 5
    Last Post: 20th July 2011, 22:06
  3. Replies: 2
    Last Post: 9th June 2010, 16:08
  4. MainWindow::resizeEvent - Infinite Cycle
    By metRo_ in forum Qt Programming
    Replies: 2
    Last Post: 1st June 2010, 23:33
  5. How use Model view with a tree wich have Cycle ?
    By weepdoo in forum Qt Programming
    Replies: 2
    Last Post: 9th December 2008, 17:05

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.