Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Inconsistant results using Qt
Forum Updated to NodeBB v4.3 + New Features

Inconsistant results using Qt

Scheduled Pinned Locked Moved C++ Gurus
1 Posts 1 Posters 676 Views 1 Watching
  • 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.
  • S Offline
    S Offline
    SteveFerry
    wrote on last edited by
    #1

    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 www.baart.co.uk/adc.zip

    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.

    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