PDA

View Full Version : Which is the better solution to the realtime plot of data from external device?



honestapple
13th February 2013, 16:25
Hello,
I am a newbie to this forum. Now, I need to plot some realtime data which are received from external device through serial port. I am using QT4.8.4 and qwt6.0.2 on Windows XP. I have finished the fundamental function based on the oscilloscope example according to the following steps.
First, I set up two independent thread for receiving data from serial port and plot them on the screen. After the data are received, the receiving thread release a signal to the main GUI. Then, the received data will be explained and displayed in a textbrowser. After done that, the main GUI release a signal to the plot thread to plot data.
I still have two ideas for this task. One is starting a timer when I start to read data. While the data are ready, I could record the time and process the data, then append the point s(time, data) to the plot. Another one use the class QwtSamplingThread as receiving thread. The class can call a sample() method to collect and store data, so I could put read serial port operation in this method. These are just ideas and I still do not know how to implement them. My question is which one is better compared with the apparent method I am using? I need some advice.
Thanks a lot.