Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Serial port Communication with pc through serial Adapter
Forum Updated to NodeBB v4.3 + New Features

Serial port Communication with pc through serial Adapter

Scheduled Pinned Locked Moved General and Desktop
45 Posts 6 Posters 6.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J.HilkJ J.Hilk

    @sankarapandiyan

    void MainWindow::serialReceived()
    {
        ....
        QMetaObject::invokeMethod(this, &MainWindow::checkAndSendData, Qt::QueuedConnection);
    }
    
    void MainWindow::serialReceived()
    
    {
        QString glen = serial->readAll();
        if (glen.length()>0){
        /*QString*/ line = ui->receive->toPlainText();
        ui->receive->setText(ui->receive->toPlainText()+line+"\n");
        ui->receive->setText(line + "\r\n" + glen + "\r\n");
        line = txt3;
        }
       QMetaObject::invokeMethod(this, &MainWindow::checkAndSendData, Qt::QueuedConnection);
    }
    
    sankarapandiyanS Offline
    sankarapandiyanS Offline
    sankarapandiyan
    wrote on last edited by sankarapandiyan
    #30

    @J-Hilk said in Serial port Communication with pc through serial Adapter:

    void MainWindow::serialReceived()

    {
    QString glen = serial->readAll();
    if (glen.length()>0){
    /QString/ line = ui->receive->toPlainText();
    ui->receive->setText(ui->receive->toPlainText()+line+"\n");
    ui->receive->setText(line + "\r\n" + glen + "\r\n");
    line = txt3;
    }
    QMetaObject::invokeMethod(this, &MainWindow::checkAndSendData, Qt::QueuedConnection);
    }

    I Have tried this my output is same like this

    alternate text
    this is my code is there is any problem in my code

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QList>
    #include <QComboBox>
    #include <QString>
    #include <QTextEdit>
    #include <QTime>
    #include <QDebug>
    #include <QtSerialPort/QSerialPortInfo>
    #include <QtSerialPort>
    #include <QFile>
    #include <QList>
    
      QString line ;
      QString txt3;
    QSerialPort *serial;
    QStringList m_lines;
    //QByteArray rawData;
    
    
    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
    {
    
        ui->setupUi(this);
    
        QString filename1="/home/adx-soft1/Shankar/serial/myfile1.txt";
          QFile file(filename1);
          if(!file.exists()){
              qDebug() << "NO FILE "<<filename1;
          }else{
              qDebug() << filename1<<" ...";
          }
          QString line1;
          ui->sender->clear();
          if (file.open(QIODevice::ReadOnly | QIODevice::Text)){ ui->sender->setText(file.readAll()); }
    
        QList<QSerialPortInfo> list;
        list = QSerialPortInfo::availablePorts();
    
        for (int i= 0; i < list.length(); i++)
        {
            ui->comboBox->addItem(list[i].portName());
    
        }
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
        serial->close();
    }
    
    
    void MainWindow::on_pushButton_clicked()
    {
        serial = new QSerialPort (this) ;
        serial->setPortName(ui->comboBox->currentText());
        serial->setBaudRate (QSerialPort::Baud115200);
        serial->setDataBits(QSerialPort::Data8);
        serial->setParity (QSerialPort::NoParity);
        serial->setStopBits (QSerialPort::OneStop);
        serial->setFlowControl(QSerialPort::NoFlowControl);
        serial->open(QIODevice::ReadWrite);
        connect(serial,SIGNAL(readyRead()),this, SLOT (serialReceived()));
    //    connect(serial, &QSerialPort::readyRead,this, &MainWindow::serialReceived);
    
       ui->progressBar->setValue(100);
    //    ui->receive->clear();
    }
    
    void MainWindow::checkAndSendData()
    {
        if(!m_lines.isEmpty()){
            QByteArray inBytes;
            QByteArray baToSend = m_lines.takeFirst().toUtf8();
            serial->write(baToSend);
            ui->aknowmnt->setText("Sent Message -->" "\n"+ QString(baToSend) + "\n");
        } else {
            ui->aknowmnt->setText("Receiving ");
        }
    }
    
    void MainWindow::on_send_clicked()
    {
         line   = ui->sender->toPlainText();
        QString txt1 = ui->receive->toPlainText();
        /*QString*/ txt3 = ui->aknowmnt->toPlainText();
    
         if(m_lines.isEmpty()){
        QFile inputFile(QString("/home/adx-soft1/Shankar/serial/myfile1.txt"));
        inputFile.open(QIODevice::ReadOnly);
        if (!inputFile.isOpen())
            return;
    
        QTextStream stream(&inputFile);
        while (!stream.atEnd()){
                line = stream.readLine();
                m_lines.append(line+QString("\r\n"));
        }
    
         }
         checkAndSendData();
    
    }
    void MainWindow::serialReceived()
    
    {
    
        QString glen = serial->readAll();
        if (glen.length()>0){
        /*QString*/ line = ui->receive->toPlainText();
        ui->receive->setText(ui->receive->toPlainText()+line+"\n");
        ui->receive->setText(line + "\r\n" + glen + "\r\n");
        line = txt3;
        }
       checkAndSendData();
       QMetaObject::invokeMethod(this, &MainWindow::checkAndSendData, Qt::QueuedConnection);
    
    }
    

    But I have not get the correct output @J-Hilk

    small_birdS 1 Reply Last reply
    0
    • sankarapandiyanS sankarapandiyan

      @J-Hilk said in Serial port Communication with pc through serial Adapter:

      void MainWindow::serialReceived()

      {
      QString glen = serial->readAll();
      if (glen.length()>0){
      /QString/ line = ui->receive->toPlainText();
      ui->receive->setText(ui->receive->toPlainText()+line+"\n");
      ui->receive->setText(line + "\r\n" + glen + "\r\n");
      line = txt3;
      }
      QMetaObject::invokeMethod(this, &MainWindow::checkAndSendData, Qt::QueuedConnection);
      }

      I Have tried this my output is same like this

      alternate text
      this is my code is there is any problem in my code

      #include "mainwindow.h"
      #include "ui_mainwindow.h"
      #include <QList>
      #include <QComboBox>
      #include <QString>
      #include <QTextEdit>
      #include <QTime>
      #include <QDebug>
      #include <QtSerialPort/QSerialPortInfo>
      #include <QtSerialPort>
      #include <QFile>
      #include <QList>
      
        QString line ;
        QString txt3;
      QSerialPort *serial;
      QStringList m_lines;
      //QByteArray rawData;
      
      
      MainWindow::MainWindow(QWidget *parent)
          : QMainWindow(parent)
          , ui(new Ui::MainWindow)
      {
      
          ui->setupUi(this);
      
          QString filename1="/home/adx-soft1/Shankar/serial/myfile1.txt";
            QFile file(filename1);
            if(!file.exists()){
                qDebug() << "NO FILE "<<filename1;
            }else{
                qDebug() << filename1<<" ...";
            }
            QString line1;
            ui->sender->clear();
            if (file.open(QIODevice::ReadOnly | QIODevice::Text)){ ui->sender->setText(file.readAll()); }
      
          QList<QSerialPortInfo> list;
          list = QSerialPortInfo::availablePorts();
      
          for (int i= 0; i < list.length(); i++)
          {
              ui->comboBox->addItem(list[i].portName());
      
          }
      }
      
      MainWindow::~MainWindow()
      {
          delete ui;
          serial->close();
      }
      
      
      void MainWindow::on_pushButton_clicked()
      {
          serial = new QSerialPort (this) ;
          serial->setPortName(ui->comboBox->currentText());
          serial->setBaudRate (QSerialPort::Baud115200);
          serial->setDataBits(QSerialPort::Data8);
          serial->setParity (QSerialPort::NoParity);
          serial->setStopBits (QSerialPort::OneStop);
          serial->setFlowControl(QSerialPort::NoFlowControl);
          serial->open(QIODevice::ReadWrite);
          connect(serial,SIGNAL(readyRead()),this, SLOT (serialReceived()));
      //    connect(serial, &QSerialPort::readyRead,this, &MainWindow::serialReceived);
      
         ui->progressBar->setValue(100);
      //    ui->receive->clear();
      }
      
      void MainWindow::checkAndSendData()
      {
          if(!m_lines.isEmpty()){
              QByteArray inBytes;
              QByteArray baToSend = m_lines.takeFirst().toUtf8();
              serial->write(baToSend);
              ui->aknowmnt->setText("Sent Message -->" "\n"+ QString(baToSend) + "\n");
          } else {
              ui->aknowmnt->setText("Receiving ");
          }
      }
      
      void MainWindow::on_send_clicked()
      {
           line   = ui->sender->toPlainText();
          QString txt1 = ui->receive->toPlainText();
          /*QString*/ txt3 = ui->aknowmnt->toPlainText();
      
           if(m_lines.isEmpty()){
          QFile inputFile(QString("/home/adx-soft1/Shankar/serial/myfile1.txt"));
          inputFile.open(QIODevice::ReadOnly);
          if (!inputFile.isOpen())
              return;
      
          QTextStream stream(&inputFile);
          while (!stream.atEnd()){
                  line = stream.readLine();
                  m_lines.append(line+QString("\r\n"));
          }
      
           }
           checkAndSendData();
      
      }
      void MainWindow::serialReceived()
      
      {
      
          QString glen = serial->readAll();
          if (glen.length()>0){
          /*QString*/ line = ui->receive->toPlainText();
          ui->receive->setText(ui->receive->toPlainText()+line+"\n");
          ui->receive->setText(line + "\r\n" + glen + "\r\n");
          line = txt3;
          }
         checkAndSendData();
         QMetaObject::invokeMethod(this, &MainWindow::checkAndSendData, Qt::QueuedConnection);
      
      }
      

      But I have not get the correct output @J-Hilk

      small_birdS Offline
      small_birdS Offline
      small_bird
      wrote on last edited by
      #31

      @sankarapandiyan check your encode function

      sankarapandiyanS 1 Reply Last reply
      1
      • small_birdS small_bird

        @sankarapandiyan check your encode function

        sankarapandiyanS Offline
        sankarapandiyanS Offline
        sankarapandiyan
        wrote on last edited by
        #32

        @small_bird Encode function means What you mean ? i didnt get you

        1 Reply Last reply
        0
        • J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by J.Hilk
          #33

          @sankarapandiyan
          ok, lets simplify your code, I assume receive and aknowmntare QTextEdits or QTextBrowser, since they have a toPlainTextfunction

          void MainWindow::checkAndSendData()
          {
              if(!m_lines.isEmpty()){
                  QByteArray baToSend = m_lines.takeFirst().toUtf8();
                  serial->write(baToSend);
                  ui->aknowmnt->append("Sent Message --> "+ QString(baToSend));
              } else {
                  ui->aknowmnt->append("All are send ");
              }
          }
          
          void MainWindow::serialReceived()
          
          {
              QString glen = serial->readAll();
              if (glen.length()>0){
                   ui->receive->append( "Received -->" + QString(glen));
              }
             QMetaObject::invokeMethod(this, &MainWindow::checkAndSendData, Qt::QueuedConnection);
          
          }
          

          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          sankarapandiyanS 2 Replies Last reply
          1
          • J.HilkJ J.Hilk

            @sankarapandiyan
            ok, lets simplify your code, I assume receive and aknowmntare QTextEdits or QTextBrowser, since they have a toPlainTextfunction

            void MainWindow::checkAndSendData()
            {
                if(!m_lines.isEmpty()){
                    QByteArray baToSend = m_lines.takeFirst().toUtf8();
                    serial->write(baToSend);
                    ui->aknowmnt->append("Sent Message --> "+ QString(baToSend));
                } else {
                    ui->aknowmnt->append("All are send ");
                }
            }
            
            void MainWindow::serialReceived()
            
            {
                QString glen = serial->readAll();
                if (glen.length()>0){
                     ui->receive->append( "Received -->" + QString(glen));
                }
               QMetaObject::invokeMethod(this, &MainWindow::checkAndSendData, Qt::QueuedConnection);
            
            }
            
            sankarapandiyanS Offline
            sankarapandiyanS Offline
            sankarapandiyan
            wrote on last edited by sankarapandiyan
            #34

            @J-Hilk

            Yes i have tried this method , the correct data is not shown in the receiver side ..

            alternate text

            void MainWindow::on_pushButton_clicked()
            {
                serial = new QSerialPort (this) ;
                serial->setPortName(ui->comboBox->currentText());
                serial->setBaudRate (QSerialPort::Baud115200);
                serial->setDataBits(QSerialPort::Data8);
                serial->setParity (QSerialPort::NoParity);
                serial->setStopBits (QSerialPort::OneStop);
                serial->setFlowControl(QSerialPort::NoFlowControl);
                serial->open(QIODevice::ReadWrite);
            //    connect(serial,SIGNAL(readyRead()),this, SLOT (serialReceived()));
                connect(serial, &QSerialPort::readyRead,this, &MainWindow::serialReceived);
            
               ui->progressBar->setValue(100);
            //    ui->receive->clear();
            }
            
            void MainWindow::checkAndSendData()
            {
                if(!m_lines.isEmpty()){
                    QByteArray baToSend = m_lines.takeFirst().toUtf8();
                    serial->write(baToSend);
                    ui->aknowmnt->append("Sent Message --> "+ QString(baToSend));
                } else {
                    ui->aknowmnt->append("All are send ");
                }
            }
            
            void MainWindow::on_send_clicked()
            {
                 line   = ui->sender->toPlainText();
                QString txt1 = ui->receive->toPlainText();
                /*QString*/ txt3 = ui->aknowmnt->toPlainText();
            
                 if(m_lines.isEmpty()){
                QFile inputFile(QString("/home/adx-soft1/Shankar/serial/myfile1.txt"));
                inputFile.open(QIODevice::ReadOnly);
                if (!inputFile.isOpen())
                    return;
            
                QTextStream stream(&inputFile);
                while (!stream.atEnd()){
                        line = stream.readLine();
                        m_lines.append(line+QString("\r\n"));
                }
            
                 }
                 checkAndSendData();
            
            }
            
            void MainWindow::serialReceived()
            
            {
                QString glen = serial->readAll();
                if (glen.length()>0){
                     ui->receive->append( "Received -->" + QString(glen));
                }
               QMetaObject::invokeMethod(this, &MainWindow::checkAndSendData, Qt::QueuedConnection);
            }
            
            J.HilkJ 1 Reply Last reply
            0
            • J.HilkJ J.Hilk

              @sankarapandiyan
              ok, lets simplify your code, I assume receive and aknowmntare QTextEdits or QTextBrowser, since they have a toPlainTextfunction

              void MainWindow::checkAndSendData()
              {
                  if(!m_lines.isEmpty()){
                      QByteArray baToSend = m_lines.takeFirst().toUtf8();
                      serial->write(baToSend);
                      ui->aknowmnt->append("Sent Message --> "+ QString(baToSend));
                  } else {
                      ui->aknowmnt->append("All are send ");
                  }
              }
              
              void MainWindow::serialReceived()
              
              {
                  QString glen = serial->readAll();
                  if (glen.length()>0){
                       ui->receive->append( "Received -->" + QString(glen));
                  }
                 QMetaObject::invokeMethod(this, &MainWindow::checkAndSendData, Qt::QueuedConnection);
              
              }
              
              sankarapandiyanS Offline
              sankarapandiyanS Offline
              sankarapandiyan
              wrote on last edited by
              #35

              @J-Hilk said in Serial port Communication with pc through serial Adapter:

              ok, lets simplify your code, I assume receive and aknowmntare QTextEdits or QTextBrowser, since they have a toPlainTextfunction

              Yes Its a QTextEdits

              1 Reply Last reply
              0
              • sankarapandiyanS sankarapandiyan

                @J-Hilk

                Yes i have tried this method , the correct data is not shown in the receiver side ..

                alternate text

                void MainWindow::on_pushButton_clicked()
                {
                    serial = new QSerialPort (this) ;
                    serial->setPortName(ui->comboBox->currentText());
                    serial->setBaudRate (QSerialPort::Baud115200);
                    serial->setDataBits(QSerialPort::Data8);
                    serial->setParity (QSerialPort::NoParity);
                    serial->setStopBits (QSerialPort::OneStop);
                    serial->setFlowControl(QSerialPort::NoFlowControl);
                    serial->open(QIODevice::ReadWrite);
                //    connect(serial,SIGNAL(readyRead()),this, SLOT (serialReceived()));
                    connect(serial, &QSerialPort::readyRead,this, &MainWindow::serialReceived);
                
                   ui->progressBar->setValue(100);
                //    ui->receive->clear();
                }
                
                void MainWindow::checkAndSendData()
                {
                    if(!m_lines.isEmpty()){
                        QByteArray baToSend = m_lines.takeFirst().toUtf8();
                        serial->write(baToSend);
                        ui->aknowmnt->append("Sent Message --> "+ QString(baToSend));
                    } else {
                        ui->aknowmnt->append("All are send ");
                    }
                }
                
                void MainWindow::on_send_clicked()
                {
                     line   = ui->sender->toPlainText();
                    QString txt1 = ui->receive->toPlainText();
                    /*QString*/ txt3 = ui->aknowmnt->toPlainText();
                
                     if(m_lines.isEmpty()){
                    QFile inputFile(QString("/home/adx-soft1/Shankar/serial/myfile1.txt"));
                    inputFile.open(QIODevice::ReadOnly);
                    if (!inputFile.isOpen())
                        return;
                
                    QTextStream stream(&inputFile);
                    while (!stream.atEnd()){
                            line = stream.readLine();
                            m_lines.append(line+QString("\r\n"));
                    }
                
                     }
                     checkAndSendData();
                
                }
                
                void MainWindow::serialReceived()
                
                {
                    QString glen = serial->readAll();
                    if (glen.length()>0){
                         ui->receive->append( "Received -->" + QString(glen));
                    }
                   QMetaObject::invokeMethod(this, &MainWindow::checkAndSendData, Qt::QueuedConnection);
                }
                
                J.HilkJ Offline
                J.HilkJ Offline
                J.Hilk
                Moderators
                wrote on last edited by J.Hilk
                #36

                @sankarapandiyan
                you're obviously receiving non ascii bytes

                void MainWindow::serialReceived()
                
                {
                    QByteArray glen = serial->readAll();
                    if (glen.length()>0){
                         ui->receive->append( QString("Received --> %1").arg(QString(glen.toHex(' ')));
                    }
                   QMetaObject::invokeMethod(this, &MainWindow::checkAndSendData, Qt::QueuedConnection);
                
                }
                

                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                sankarapandiyanS 1 Reply Last reply
                1
                • J.HilkJ J.Hilk

                  @sankarapandiyan
                  you're obviously receiving non ascii bytes

                  void MainWindow::serialReceived()
                  
                  {
                      QByteArray glen = serial->readAll();
                      if (glen.length()>0){
                           ui->receive->append( QString("Received --> %1").arg(QString(glen.toHex(' ')));
                      }
                     QMetaObject::invokeMethod(this, &MainWindow::checkAndSendData, Qt::QueuedConnection);
                  
                  }
                  
                  sankarapandiyanS Offline
                  sankarapandiyanS Offline
                  sankarapandiyan
                  wrote on last edited by sankarapandiyan
                  #37

                  @J-Hilk said in Serial port Communication with pc through serial Adapter:

                  void MainWindow::serialReceived()

                  {
                  QByteArray glen = serial->readAll();
                  if (glen.length()>0){
                  ui->receive->append( QString("Received --> %1").arg(QString(glen.toHex(' ')));
                  }
                  QMetaObject::invokeMethod(this, &MainWindow::checkAndSendData, Qt::QueuedConnection);

                  }

                  this out put is what i receive from another pc
                  alternate text
                  And the next below image is shown as a data send as some thing different

                  alternate text

                  Even Now also i did not get the exact output sir what should i do i am stuck here .. @J-Hilk

                  KroMignonK 1 Reply Last reply
                  0
                  • sankarapandiyanS sankarapandiyan

                    @J-Hilk said in Serial port Communication with pc through serial Adapter:

                    void MainWindow::serialReceived()

                    {
                    QByteArray glen = serial->readAll();
                    if (glen.length()>0){
                    ui->receive->append( QString("Received --> %1").arg(QString(glen.toHex(' ')));
                    }
                    QMetaObject::invokeMethod(this, &MainWindow::checkAndSendData, Qt::QueuedConnection);

                    }

                    this out put is what i receive from another pc
                    alternate text
                    And the next below image is shown as a data send as some thing different

                    alternate text

                    Even Now also i did not get the exact output sir what should i do i am stuck here .. @J-Hilk

                    KroMignonK Offline
                    KroMignonK Offline
                    KroMignon
                    wrote on last edited by
                    #38

                    @sankarapandiyan Maybe it is a silly question, but are you sure the serial settings your are using, are correct?

                    • 115200 bauds?
                    • 8 bits?

                    Are you using a crossed/null modem serial cable? ==> cf https://en.wikipedia.org/wiki/Null_modem.

                    It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                    sankarapandiyanS 1 Reply Last reply
                    2
                    • KroMignonK KroMignon

                      @sankarapandiyan Maybe it is a silly question, but are you sure the serial settings your are using, are correct?

                      • 115200 bauds?
                      • 8 bits?

                      Are you using a crossed/null modem serial cable? ==> cf https://en.wikipedia.org/wiki/Null_modem.

                      sankarapandiyanS Offline
                      sankarapandiyanS Offline
                      sankarapandiyan
                      wrote on last edited by sankarapandiyan
                      #39

                      @KroMignon I am Using hl-340 usb-serial adapter . so here , what i want to give as a baud rate.

                      void MainWindow::on_pushButton_clicked()
                      {
                          serial = new QSerialPort (this) ;
                          serial->setPortName(ui->comboBox->currentText());
                          serial->setBaudRate (QSerialPort::Baud115200);
                          serial->setDataBits(QSerialPort::Data8);
                          serial->setParity (QSerialPort::NoParity);
                          serial->setStopBits (QSerialPort::OneStop);
                          serial->setFlowControl(QSerialPort::NoFlowControl);
                          serial->open(QIODevice::ReadWrite);
                          connect(serial,SIGNAL(readyRead()),this, SLOT (serialReceived()));
                          ui->progressBar->setValue(100);
                      //    ui->receive->clear();
                      }
                      
                      KroMignonK 1 Reply Last reply
                      0
                      • sankarapandiyanS sankarapandiyan

                        @KroMignon I am Using hl-340 usb-serial adapter . so here , what i want to give as a baud rate.

                        void MainWindow::on_pushButton_clicked()
                        {
                            serial = new QSerialPort (this) ;
                            serial->setPortName(ui->comboBox->currentText());
                            serial->setBaudRate (QSerialPort::Baud115200);
                            serial->setDataBits(QSerialPort::Data8);
                            serial->setParity (QSerialPort::NoParity);
                            serial->setStopBits (QSerialPort::OneStop);
                            serial->setFlowControl(QSerialPort::NoFlowControl);
                            serial->open(QIODevice::ReadWrite);
                            connect(serial,SIGNAL(readyRead()),this, SLOT (serialReceived()));
                            ui->progressBar->setValue(100);
                        //    ui->receive->clear();
                        }
                        
                        KroMignonK Offline
                        KroMignonK Offline
                        KroMignon
                        wrote on last edited by
                        #40

                        @sankarapandiyan said in Serial port Communication with pc through serial Adapter:

                        I am Using hl-340 usb-serial adapter

                        Okay, that's for having a RS232 port on you PC, but to connect two PC you need a "null modem" cable (to cross Tx and Rx signal between the 2 serial ports).
                        Have you something like this?

                        It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                        sankarapandiyanS 1 Reply Last reply
                        2
                        • KroMignonK KroMignon

                          @sankarapandiyan said in Serial port Communication with pc through serial Adapter:

                          I am Using hl-340 usb-serial adapter

                          Okay, that's for having a RS232 port on you PC, but to connect two PC you need a "null modem" cable (to cross Tx and Rx signal between the 2 serial ports).
                          Have you something like this?

                          sankarapandiyanS Offline
                          sankarapandiyanS Offline
                          sankarapandiyan
                          wrote on last edited by
                          #41

                          @KroMignon Yes you are right ..
                          this is my null modem i am using
                          alternate text

                          I dontknow i am ryt or wrong and i am new to this topic .. the above image shows my serial adapter with null modem

                          KroMignonK 1 Reply Last reply
                          0
                          • sankarapandiyanS sankarapandiyan

                            @KroMignon Yes you are right ..
                            this is my null modem i am using
                            alternate text

                            I dontknow i am ryt or wrong and i am new to this topic .. the above image shows my serial adapter with null modem

                            KroMignonK Offline
                            KroMignonK Offline
                            KroMignon
                            wrote on last edited by
                            #42

                            @sankarapandiyan Okay, so the hardware side seems to be right. Can you give your software environnement:

                            • Operation system you are using (Linux ? Windows? MacOS?)
                            • Qt Kit Version you are using (not Qt Creator version!)

                            It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                            sankarapandiyanS 1 Reply Last reply
                            2
                            • KroMignonK KroMignon

                              @sankarapandiyan Okay, so the hardware side seems to be right. Can you give your software environnement:

                              • Operation system you are using (Linux ? Windows? MacOS?)
                              • Qt Kit Version you are using (not Qt Creator version!)
                              sankarapandiyanS Offline
                              sankarapandiyanS Offline
                              sankarapandiyan
                              wrote on last edited by sankarapandiyan
                              #43

                              @KroMignon

                              Operation system you are using (Linux ? Windows? MacOS?)
                              Linux_Ubuntu18.04.3
                              Qt Kit Version you are using (not Qt Creator version!)
                              **I dont know how to find the Qt kit version but any way little bit i have find out i think ..the below image shows the version of kit ** @KroMignon

                              alternate text

                              KroMignonK 1 Reply Last reply
                              0
                              • sankarapandiyanS sankarapandiyan

                                @KroMignon

                                Operation system you are using (Linux ? Windows? MacOS?)
                                Linux_Ubuntu18.04.3
                                Qt Kit Version you are using (not Qt Creator version!)
                                **I dont know how to find the Qt kit version but any way little bit i have find out i think ..the below image shows the version of kit ** @KroMignon

                                alternate text

                                KroMignonK Offline
                                KroMignonK Offline
                                KroMignon
                                wrote on last edited by KroMignon
                                #44

                                @sankarapandiyan said in Serial port Communication with pc through serial Adapter:

                                Linux_Ubuntu18.04.3

                                Have you tried your serial interface with another tool like cutecom.
                                On Ubuntu/Debian, you can install it with apt-get install cutecom
                                e045fd7e-0da7-410b-949d-e27f7a221657-image.png

                                It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                                sankarapandiyanS 1 Reply Last reply
                                1
                                • KroMignonK KroMignon

                                  @sankarapandiyan said in Serial port Communication with pc through serial Adapter:

                                  Linux_Ubuntu18.04.3

                                  Have you tried your serial interface with another tool like cutecom.
                                  On Ubuntu/Debian, you can install it with apt-get install cutecom
                                  e045fd7e-0da7-410b-949d-e27f7a221657-image.png

                                  sankarapandiyanS Offline
                                  sankarapandiyanS Offline
                                  sankarapandiyan
                                  wrote on last edited by sankarapandiyan
                                  #45

                                  @KroMignon

                                  YEs I have done its working in the application ... @KroMignon

                                  alternate text

                                  1 Reply Last reply
                                  0

                                  • Login

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • Users
                                  • Groups
                                  • Search
                                  • Get Qt Extensions
                                  • Unsolved