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

Fixing multi-channel mode.

This commit is contained in:
Juan64Bits
2010-04-12 21:26:26 -05:00
parent beca2e0bd3
commit 7a462423ed
11 changed files with 347 additions and 68 deletions

View File

@@ -17,12 +17,12 @@ MainWindow::MainWindow(QWidget *parent)
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");
ADC1->setBufferLen(240);
ADC1->setClockDiv(ADC_SPI_CLKDIV_MIN); //Max. speed
ADC1->setMuxChannels(1);
printf("\nTaking 120 samples by channel at Fs=99KHz (trigger=50ms)\n");
}
MainWindow::~MainWindow()
@@ -36,26 +36,12 @@ void MainWindow::updateGraph()
int tempD;
//CHANNEL 0
dataADC=ADC1->takeSamplesADC(0);
for(int i=0; i< 120/2; i++)
{
//printf("[%08X]",dataADC[i]);
tempD = dataADC[i]&0xFFFF;
for(int i=0; i< 240/2; i++)
{
tempD = dataADC[i]&0x0FFF;
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;
tempD = (dataADC[i]>>16)&0x0FFF;
ui->Graph->addPoint2(tempD);
}