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. Create a simple RS232 interface
Forum Update on Monday, May 27th 2025

Create a simple RS232 interface

Scheduled Pinned Locked Moved General and Desktop
23 Posts 5 Posters 16.0k Views
  • 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.
  • Q Offline
    Q Offline
    qt52
    wrote on last edited by
    #5

    Now my code look like this way:

    @#-------------------------------------------------

    Project created by QtCreator 2011-06-18T12:45:21

    #-------------------------------------------------

    QT += core gui

    TARGET = portcomsender
    TEMPLATE = app

    This are the to line you have to add

    INCLUDEPATH += C:/Qt/qextserialport-1.2win-alpha/
    LIBS += -L“C:/Qt/qextserialport-1.2win-alpha/build/” -llibqextserialportd.a

    SOURCES += main.cpp
    widget.cpp

    HEADERS += widget.h@

    after compiled the result still show

    Error while building project portcomsender (target: Bureau)
    When executing build step ‘qmake’

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jalomic
      wrote on last edited by
      #6

      Replace:
      LIBS += -L“C:/Qt/qextserialport-1.2win-alpha/build/” -libqextserialportd.a
      by this:

      LIBS += -L"C:/Qt/qextserialport-1.2win-alpha/build/" -lqextserialport

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        qt52
        wrote on last edited by
        #7

        In my build folder have 2 files (libqextserialportd.a and qextserialportd.dll) and 2 folder (moc and obj)

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          qt52
          wrote on last edited by
          #8

          After replace, still the same :(

          1 Reply Last reply
          0
          • Q Offline
            Q Offline
            qt52
            wrote on last edited by
            #9

            I found the build setting on left corner, is it something wrong with my build setting? I did tried 4 difference setting but result still the same.

            4.7.0 Debug
            4.7.0 Release
            Qt 4.7.3 for Desktop - MinGW 4.4 (Qt SDK) Debug
            Qt 4.7.3 for Desktop - MinGW 4.4 (Qt SDK) Release

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jalomic
              wrote on last edited by
              #10

              Delete LIBS += -L“C:/Qt/qextserialport-1.2win-alpha/build/” -llibqextserialportd.a
              and post here output.

              1 Reply Last reply
              0
              • Q Offline
                Q Offline
                qt52
                wrote on last edited by
                #11

                http://imageshack.us/photo/my-images/203/buildn.jpg/
                ok, Can you see the image? I think a bit too small for you.

                !http://i.imgur.com/0av0q.jpg(Build1)!

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  jalomic
                  wrote on last edited by
                  #12

                  strange behavior

                  Recreate project

                  1 Reply Last reply
                  0
                  • Q Offline
                    Q Offline
                    qt52
                    wrote on last edited by
                    #13

                    Should i put the build folder ( .a and .dll) inside the project folder?

                    1 Reply Last reply
                    0
                    • Q Offline
                      Q Offline
                      qt52
                      wrote on last edited by
                      #14

                      When i unzip the file and double click the portcomsender.pro project file it prompt out this dialog.

                      !http://i.imgur.com/H1iY5.jpg(Build2)!

                      Is it this the issue?

                      How can i use his .cpp and .h file to create my own project environmental?

                      1 Reply Last reply
                      0
                      • sierdzioS Offline
                        sierdzioS Offline
                        sierdzio
                        Moderators
                        wrote on last edited by
                        #15

                        You should not use old .user files. Delete this file before opening a copied project.

                        (Z(:^

                        1 Reply Last reply
                        0
                        • sierdzioS Offline
                          sierdzioS Offline
                          sierdzio
                          Moderators
                          wrote on last edited by
                          #16

                          You can also consider testing the official Qt Playground project: "QtSerialPort":https://qt.gitorious.org/qtplayground/qtserialport.

                          (Z(:^

                          1 Reply Last reply
                          0
                          • Q Offline
                            Q Offline
                            qt52
                            wrote on last edited by
                            #17

                            Hello Sierdzio,

                            Thanks for your advice. Ya, in the folder i found this portcomsender.pro.user file. After deleted and open the project file again the dialog never prompt out anymore.

                            After this will ask for Target setup. I configured:
                            Desktop - Tick
                            Create Build Configurations: For Each Qt Version One Debug And One Release
                            Use Shadow Building - Tick
                            Click Finish

                            http://i.imgur.com/fUYLq.jpg
                            I try compile and there are few error prompt out. The image shows the error message.

                            emmm...The program look not so complicated but when compile that time is not that easy.

                            Is it possible to help me to create a sample project so that i can have a reference and easy for me to check where's the error?
                            This sample tutorial i get it from http://www.instructables.com/id/Control-your-arduino-from-your-PC-with-the-Qt-Gui/step3/Lets-program/

                            Thank you very much, I will test QtSerialPort later. It's quite interested to have working sample to test. This sample code is not a tutorial i guess it should be least explanation, hopefully i can understand the coding. I have C programming knowledge but lack C++ and this the first time i try windows programming. :)

                            Let me have a try first ya...Any question i will come back again..

                            Best Regards,
                            Qt52

                            1 Reply Last reply
                            0
                            • sierdzioS Offline
                              sierdzioS Offline
                              sierdzio
                              Moderators
                              wrote on last edited by
                              #18

                              You have got some missing includes - this is still all about LIBS and INCLUDEPATH in .pro file. I know it's hard to get right the first time you try. Maybe if you are new to this all, it would be better to try something using Qt classes only? You can take a look at example of including custom libs in my "QEasyShell":https://github.com/sierdzio/qeasyshell/blob/master/examples/basic/basic.pro project, but I'm using .pri so I'm not sure it will make it easier for you... although it might. Just be sure to read the global.pri in addition to the one I've linked.

                              (Z(:^

                              1 Reply Last reply
                              0
                              • H Offline
                                H Offline
                                harshit_smart
                                wrote on last edited by
                                #19

                                Hey bro ..m a newbie trying exactly the same program from instructables..
                                In the desktop prompt as mentioned in step 2 for controlling arduino using qt gui... i am getting the following error..please help if you have fixed the isse you were facing..thnx

                                C:\Qt\qextserialport-1.2win-alpha>C:\Qt\Qt5.3.0\Tools\mingw482_32\bin\mingw32-ma
                                ke.exe
                                C:/Qt/Qt5.3.0/Tools/mingw482_32/bin/mingw32-make -f Makefile.Release
                                mingw32-make[1]: Entering directory 'C:/Qt/qextserialport-1.2win-alpha'
                                g++ -c -pipe -fno-keep-inline-dllexport -O2 -Wall -Wextra -frtti -fexceptions -m
                                threads -DUNICODE -D_TTY_WIN_ -DQT_NO_DEBUG -DQT_CORE_LIB -I. -I'../Qt5.3.0/5.3/
                                mingw482_32/include' -I'../Qt5.3.0/5.3/mingw482_32/include/QtCore' -I'build/moc'
                                -I'../Qt5.3.0/5.3/mingw482_32/mkspecs/win32-g++' -o build/obj/win_qextserialpor
                                t.o win_qextserialport.cpp
                                win_qextserialport.cpp: In member function 'virtual bool Win_QextSerialPort::ope
                                n(QIODevice::OpenMode)':
                                win_qextserialport.cpp:187:37: error: 'class QString' has no member named 'toAsc
                                ii'
                                Win_Handle=CreateFileA(port.toAscii(), GENERIC_READ|GENERIC_WRITE,
                                ^
                                win_qextserialport.cpp: At global scope:
                                win_qextserialport.cpp:431:6: warning: unused parameter 'c' [-Wunused-parameter]

                                void Win_QextSerialPort::ungetChar(char c) {
                                ^
                                win_qextserialport.cpp:948:6: warning: unused parameter 'msecs' [-Wunused-parame
                                ter]
                                bool Win_QextSerialPort::waitForReadyRead(int msecs)
                                ^
                                win_qextserialport.cpp: In member function 'void Win_QextSerialPort::monitorComm
                                Event()':
                                win_qextserialport.cpp:988:6: warning: suggest explicit braces to avoid ambiguou
                                s 'else' [-Wparentheses]
                                if (eventMask & EV_DSR)
                                ^
                                Makefile.Release:538: recipe for target 'build/obj/win_qextserialport.o' failed
                                mingw32-make[1]: *** [build/obj/win_qextserialport.o] Error 1
                                mingw32-make[1]: Leaving directory 'C:/Qt/qextserialport-1.2win-alpha'
                                Makefile:34: recipe for target 'release' failed
                                mingw32-make: *** [release] Error 2

                                C:\Qt\qextserialport-1.2win-alpha>

                                thanks

                                Harshit arora

                                urgent reply needed...

                                [quote author="qt52" date="1352892591"]Hello Sierdzio,

                                Thanks for your advice. Ya, in the folder i found this portcomsender.pro.user file. After deleted and open the project file again the dialog never prompt out anymore.

                                After this will ask for Target setup. I configured:
                                Desktop - Tick
                                Create Build Configurations: For Each Qt Version One Debug And One Release
                                Use Shadow Building - Tick
                                Click Finish

                                http://i.imgur.com/fUYLq.jpg
                                I try compile and there are few error prompt out. The image shows the error message.

                                emmm...The program look not so complicated but when compile that time is not that easy.

                                Is it possible to help me to create a sample project so that i can have a reference and easy for me to check where's the error?
                                This sample tutorial i get it from http://www.instructables.com/id/Control-your-arduino-from-your-PC-with-the-Qt-Gui/step3/Lets-program/

                                Thank you very much, I will test QtSerialPort later. It's quite interested to have working sample to test. This sample code is not a tutorial i guess it should be least explanation, hopefully i can understand the coding. I have C programming knowledge but lack C++ and this the first time i try windows programming. :)

                                Let me have a try first ya...Any question i will come back again..

                                Best Regards,
                                Qt52

                                [/quote]

                                1 Reply Last reply
                                0
                                • K Offline
                                  K Offline
                                  kuzulis
                                  Qt Champions 2020
                                  wrote on last edited by
                                  #20

                                  2 harshit_smart,

                                  instead of QextSerialPort you can use the QtSerialPort in your Qt5.3. The QtSerialPort is an part of an official Qt add-on package. To install it (using an official Qt installer) is enough to expand an "Addons" checkbox and to select "SerialPort" component.

                                  1 Reply Last reply
                                  0
                                  • H Offline
                                    H Offline
                                    harshit_smart
                                    wrote on last edited by
                                    #21

                                    Thanks for awaited reply ...Ill surely try that right now...but will the program work thats given in the 3rd step of instructable for connecting arduino to qt gui???

                                    [quote author="kuzulis" date="1401795947"]2 harshit_smart,

                                    instead of QextSerialPort you can use the QtSerialPort in your Qt5.3. The QtSerialPort is an part of an official Qt add-on package. To install it (using an official Qt installer) is enough to expand an "Addons" checkbox and to select "SerialPort" component. [/quote]

                                    1 Reply Last reply
                                    0
                                    • K Offline
                                      K Offline
                                      kuzulis
                                      Qt Champions 2020
                                      wrote on last edited by
                                      #22

                                      The QtSerialPort has an built-in Terminal example (and others examples). So, you can try it.

                                      PS: I don't know about protocol between Arduino and PC.

                                      1 Reply Last reply
                                      0
                                      • H Offline
                                        H Offline
                                        harshit_smart
                                        wrote on last edited by
                                        #23

                                        Hi Kuzulis,
                                        The Qt port terminal example i have already tried, that works fine....
                                        What i am trying to do is this instructable and cant really get it through....ghosh.....i never thought it would be too difficult....

                                        http://www.instructables.com/id/Control-your-arduino-from-your-PC-with-the-Qt-Gui/step3/Lets-program/

                                        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