PDA

View Full Version : Create Real-Time Oscilloscope - Best Practices



yapatel
1st April 2014, 18:57
Hi -

I have developed a real-time application on Linux using QT4. The software acquires data using an A-to-D and performs some floating point operation on the data before saving it or sending out some signal using a D-to-A.

I wish to add an oscilloscope module/widget to this application and want to know what are some best practices. I am not completely familiar with or understand all the ways possible for doing this, so I am hoping some useful feedback will be provided by QT experts.

The things (I think) I know are that I want to have a static refresh rate for the display (250ms) that takes a segment of the acquired data and plots it on the display. The questions I have are - is it better to use a standard Mdi window and then draw a grid on it and then plot on the grid or is it more computationally efficient to use something like QGraphicsScene or QGraphicsView?

The oscilloscope should be able to plot multiple channels of data at once, too.

I may be completely wrong, but hopefully someone can provide some useful insight on how I should go about doing this.

Thanks.

ChrisW67
1st April 2014, 22:40
You should look at Qwt (http://qwt.sourceforge.net/index.html), its oscilloscope example, and possibly cpu plot example.

yapatel
26th June 2014, 23:13
Hi -

Thanks for the suggestion. One quick question -

What is the performance difference between using pixmaps and between drawing curves as does the Qwt example?

I would want to do this with multiple curves at at time - my application is using a data acquisition card to acquire data and plot it as an oscilloscope would.

cszawisza
28th June 2014, 09:04
While displaying a picture even FULLHD with frequency ~20Hz on your place I will use QWT with opengl enabled.
When I was developing my oscilloscope app (1 curve, fullhd picture ~15Hz refresh) application take ~30% of my cpu without opengl, and ~3% cpu when I enable opengl (my pc: AMD Phenom II 550 and GPU NVIDIA 8400GS). I don't know how pixmap is handling such data, but believe me QWT will be sufficient :)