Can we able to plot the graph of wire which has to show the diameter in qt software



  • Hi,
    In my project i am receiving the data from the embedded device in which we are receiving the diameter measurement value from the embedded device and we are storing these data to PC through the usb cable to RS232 converter in which the data's are storing in excel format. So here my question is can we able to plot the graph of these data which i am storing in excel sheet and next is can we able to plot this below attached format graph in qt software0_1557305839646_Capture.PNG


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Do you mean you would like to make Excel render this or within your Qt application.



  • Anything is fine for me



  • i want to try in qt software where i need to read the data from the usb to rs232 cable and need to plot the graph in real time
    can you plz give me the example program for reading the data from this port



  • Hi,
    I am using qt software for reading the data from the usb to rs232 converter and i have tried this program
    #include <QCoreApplication>
    #include <QtSerialPort/QSerialPort>
    #include <QSerialPortInfo>
    #include <QDebug>
    #include <QFile>
    #include <QByteArray>
    #include<QString>

    int main(int argc, char *argv[])
    {
    QCoreApplication a(argc, argv);
    QSerialPort serialPort;
    QByteArray buf;

    serialPort.open(QIODevice::ReadOnly);
    serialPort.setPortName("COM10");
    serialPort.setBaudRate(QSerialPort::Baud38400);
    serialPort.setDataBits(QSerialPort::Data8);
    serialPort.setParity(QSerialPort::EvenParity);
    serialPort.setStopBits(QSerialPort::OneStop);
    serialPort.setFlowControl(QSerialPort::NoFlowControl);
    

    // while(1)
    //{
    //serialPort.write("h");
    buf=serialPort.readAll();
    qDebug() << "buf1 "<< buf;
    serialPort.close();
    //}

    return a.exec();
    

    }

    and serial port.pro
    QT = core
    QT -= gui #-
    QT += serialport

    TARGET = Serial-port
    CONFIG += console
    CONFIG -= app_bundle

    TEMPLATE = app

    SOURCES += main.cpp

    INSTALLS += target

    but i am getting like serial port is not open how to resolve this issue plz tell me
    i am here by attaching the file0_1557400980078_Capture123.PNG


  • Lifetime Qt Champion

    You are blocking the event loop the way you wrote it.

    Please take the time to review the examples of the QtSerialPort module.



  • @chandana said in Can we able to plot the graph of wire which has to show the diameter in qt software:

    serialPort.open(QIODevice::ReadOnly);
    serialPort.setPortName("COM10");

    Besides, this sequene is wrong and makes not sense!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.