Inconsistant results using Qt

  • I have developed an 8 channel adc board for the Raspi Pi and am trying to write some software to read data from the board and present it graphically but I seem to be getting inconsistent results and the voltages being displayed are wrong.

    I wrote a short routine to display 100 readings from the adc board. I compiled it using Geany and it worked perfectly. Then I used the same code in Qt and compiled it as a terminal program and the results were all over the place. I can't undertsnd why the same code works on Geany and not on Qt. Can anyone help?

    The code can be downloaded from

    I am not using SPIdev to communicate with the adc, instead I have written routines to use direct register access and emulate SPIdev. This way I can use any spare GPIO pins I want and assign them to CS, CLK, MISO and MOSI but in the example, I have assigned the normal pins. The zip file contains adcio.h and adcio.cpp which are the header and c++ routines for doing just that.

    The third file, adcshow.cpp, contains the main() routine which requests the data and displays it. First, it calls a function getHWrev() which checks if you have an original or new 4 core Pi and sets the gpio base address accordingly.

    If I compile adcshow using Geany, when I run it (it has to be run from sudo due to the direct register access) I get a steady list of voltages which correspond to the actual voltage measured with a multimeter. I do get a few results a couple of points higher or lower but not that many.

    If I create a project on Qt and load these files in, when I run the compiled code, I get a list of voltages much lower than what the multimeter tells me and also some wide variation in the results.

    As I want to read data from an accelerometer, do an fft of the result and make determinations of a machine's condition based on these fft's, it is important that the data is good. As it stands, the data is garbage. Any idea why?

    Thanks guys, Steve.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.