1
0
mirror of git://projects.qi-hardware.com/nn-usb-fpga.git synced 2025-04-21 12:27:27 +03:00

Adding dual channel to scope example, fixing logic and QT source code.

This commit is contained in:
Juan64Bits
2010-04-09 10:39:15 -05:00
parent 168c584b06
commit beca2e0bd3
36 changed files with 220 additions and 717 deletions

View File

@@ -0,0 +1,63 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <QTime>
#include <math.h>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(this,SIGNAL(refresh()),ui->Graph, SLOT(repaint()));
ui->Graph->setPointsPerPlot(120);
ui->Graph->setVoltsPerDiv(205);
timer1 = new QTimer(this);
timer1->start(50);
connect(timer1, SIGNAL(timeout()), this, SLOT(updateGraph()));
CHANNEL = 1;
ADC1 = new ADCw;
ADC1->testADC();
ADC1->setBufferLen(120);
ADC1->setClockDiv(ADC_SPI_CLKDIV_MAX); //Maximun speed
printf("\nTaking 300 samples each 50ms from Channel 0,1 at Fs=99KHz \n");
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::updateGraph()
{
JZ_REG * dataADC;
int tempD;
//CHANNEL 0
dataADC=ADC1->takeSamplesADC(0);
for(int i=0; i< 120/2; i++)
{
//printf("[%08X]",dataADC[i]);
tempD = dataADC[i]&0xFFFF;
ui->Graph->addPoint1(tempD+0x3ff);
tempD = dataADC[i]>>16;
ui->Graph->addPoint1(tempD+0x3ff);
}
CHANNEL = 1;
//CHANNEL 1
dataADC=ADC1->takeSamplesADC(1);
for(int i=0; i< 120/2; i++)
{
//printf("[%08X]",dataADC[i]);
tempD = dataADC[i]&0xFFFF;
ui->Graph->addPoint2(tempD);
tempD = dataADC[i]>>16;
ui->Graph->addPoint2(tempD);
}
emit refresh();
}