PDA

View Full Version : Need to set up a connection between my microcontroller and my Qt application (R/W)



alfie.max15
22nd February 2013, 18:06
I am trying to make communication between my micro-controller and my Qt application...

what i want to do is to read the data sent in from the micro-controller(connected via USB cable) and to sent data back to it as well..

i understand i need to make a serial communication which is done through the RX & TX pins of the uC and there would be a converter which then gives the signal to the D+ & D- of the USB cable...

Pls correct me if i am wrong...

I did search some sites and found that i need "QtextSerialPort" library... but is this the same thing that i need even when i am using the USB cable..
also if i need this library file... i dont know how to add them...

Please help me out in this one...its urgent...

d_stranz
22nd February 2013, 18:17
Isn't there a forum for your uC where you can ask hardware-related questions? That has nothing to do with Qt.

That forum should also have information about serial port drivers. Almost certainly if your uC is a common one such as Arduino, there are drivers available for most operating systems. Get one, install it, and read the documentation on how your read and write to the driver. Someone may have already written a Qt app to do this.

This sounds a little bit like a homework problem to me, so if it is, don't expect that someone here (or on the uC forum) is going to give you detailed information on how to do this.

alfie.max15
22nd February 2013, 18:28
Isn't there a forum for your uC where you can ask hardware-related questions? That has nothing to do with Qt.


i have done my homework on the hardware part and i know how to sent and receive data from the uC but as u see that's not the part where i am having the trouble..
I need to come up with a Qt application, so for that i am not familiar with the serial communication coding part of the Qt application...

And i tried to search the net for some help... but i was not much of a success in that..


Someone may have already written a Qt app to do this

can anyone atleast show me to that... so that i may learn fron its source code...
Pls help me start up with the serial communication coding in Qt Creator.. That's where i need the help and not the hardware part

wysota
22nd February 2013, 18:42
Ok, but what exactly is the question?

alfie.max15
22nd February 2013, 18:47
Ok, but what exactly is the question?

I want to write a Qt application from which i can communicate to my micro-controller...
i want to read the data that the uC sends and to display it in the application
Similarly i want to sent data to the uC..

d_stranz
22nd February 2013, 19:09
So, it sounds like the steps you need to take are:

1 - Learn how to identify the serial port used by your device (QextSerialEnumerator)
2 - Connect to the port (QextSerialPort:: open())
3 - Read from it (using QIODevice)
4 - Write to it (using QIODevice)

If you Google hard enough, you can find some source code for a Qt terminal emulator you might be able to adapt.

You can connect a slot to the QIODevice:: readyRead() signal, which will tell you when the device has bytes available to read. You can connect to other signals to tell you if writing was successful and when the device is being closed, etc.

alfie.max15
22nd February 2013, 19:39
Will get back with this post after i work out that much of it... thank you for your help...:)