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

Adding expansion pcb for sakc

This commit is contained in:
Juan64Bits
2010-05-10 12:21:18 -05:00
parent 07ca557286
commit 5938d6531c
528 changed files with 501298 additions and 118 deletions

View File

@@ -10,18 +10,18 @@ MainWindow::MainWindow(QWidget *parent)
{
ui->setupUi(this);
connect(this,SIGNAL(refresh()),ui->Graph, SLOT(repaint()));
ui->Graph->setPointsPerPlot(120);
ui->Graph->setPointsPerPlot(200);
ui->Graph->setVoltsPerDiv(205);
timer1 = new QTimer(this);
timer1->start(50);
connect(timer1, SIGNAL(timeout()), this, SLOT(updateGraph()));
ADC1 = new ADCw;
/*ADC1 = new ADCw;
ADC1->testADC();
ADC1->setBufferLen(240);
ADC1->setClockDiv(ADC_SPI_CLKDIV_MIN); //Max. speed
ADC1->setMuxChannels(1);
ADC1->setMuxChannels(1);*/
printf("\nTaking 120 samples by channel at Fs=99KHz (trigger=50ms)\n");
}
@@ -38,11 +38,11 @@ void MainWindow::updateGraph()
deltaCountCH1=0; deltaCountCH2=0;
idxCH1=0; idxCH2=0;
dataADC=ADC1->takeSamplesADC(0);
//dataADC=ADC1->takeSamplesADC(0);
for(int i=0; i< 240/2; i++)
{
tempD = dataADC[i]&0x0FFF;
//tempD = cos(2.6*PI*i/200)*0x200+0x200;
//tempD = dataADC[i]&0x0FFF;
tempD = sin(10*PI*i/200)*0x200+0x200;
ui->Graph->addPoint1(tempD+0x3ff);
sign2_CH1 = getSign(tempD-0x200);
@@ -57,8 +57,8 @@ void MainWindow::updateGraph()
sign1_CH1=sign2_CH1;
tempD = (dataADC[i]>>16)&0x0FFF;
//tempD = cos(5*PI*i/200)*0x200+0x200;
//tempD = (dataADC[i]>>16)&0x0FFF;
tempD = cos(10*PI*i/200)*0x200+0x200;
ui->Graph->addPoint2(tempD);
sign2_CH2 = getSign(tempD-0x200);
@@ -74,7 +74,8 @@ void MainWindow::updateGraph()
sign1_CH2=sign2_CH2;
}
double Vrms=0, Vm=0;
double Vrms=0, Vm=0;
for(int i=0; i<idxCH1; i++)
{
Vrms += pow(valCH1[i],2)/idxCH1;
@@ -83,7 +84,9 @@ void MainWindow::updateGraph()
if(deltaCountCH1>2)
{
ui->txtVrmsCH1->setText(QString::number(sqrt(Vrms)));
Vrms=sqrt(Vrms)+VrmsC;
Vm=Vm+VmC;
ui->txtVrmsCH1->setText(QString::number(Vrms));
ui->txtVmCH1->setText(QString::number(Vm));
}
else
@@ -101,7 +104,9 @@ void MainWindow::updateGraph()
if(deltaCountCH2>2)
{
ui->txtVrmsCH2->setText(QString::number(sqrt(Vrms)));
Vrms=sqrt(Vrms)+VrmsC;
Vm=Vm+VmC;
ui->txtVrmsCH2->setText(QString::number(Vrms));
ui->txtVmCH2->setText(QString::number(Vm));
}
else