AAAAAAAAAAAAAAAAAAA

Dependencies:   mbed FastPWM

Revision:
17:e2f843372f7b
Parent:
16:41e558cc18f1
--- a/main.cpp	Wed Jun 07 08:44:26 2017 +0000
+++ b/main.cpp	Tue Jul 23 08:43:23 2019 +0000
@@ -18,7 +18,7 @@
 //основные пины
 Serial serial(USBTX,USBRX);
 FastPWM mclk(PA_15);
-FastPWM sq(PB_7);
+PwmOut sq(PB_7);
 SPI DDS(PC_12, NC, PC_10);
 SPI DAC(PC_12, NC, PC_10);
 DigitalOut SYNC1(PC_11);//amp dac
@@ -75,7 +75,7 @@
 int j; //inject I
 int k; //measure I
 int belt;
-float yprint[2560];
+float yprint[2080];
 
 
 void mux();//универсальная процедура выбора канала
@@ -206,7 +206,7 @@
 {   
     IEN = 1;
     adzero = 0;
-    serial.baud(230400);
+    serial.baud(921600);
         ddsstop;dacstop;
         DDS.frequency(400000);
         DDS.format(16,2);
@@ -228,6 +228,7 @@
         else {wait_us(10); printf("7\r\n"); fflush (stdout); wait_us(100);};
         ddsreset;
         request();
+        int amountOfByte = sizeof(float) * 208 * belt;
         while(true){
         t.reset();
         t.start();
@@ -235,9 +236,10 @@
         mux_group();
         t.stop(); 
         i2g;
+        write(1, yprint, amountOfByte);
         //fout();
         //////////////////////////
-        for (yp = 0; yp < (256*belt); yp++) {printf("%.6f\r\n",yprint[yp]);};
+       // for (yp = 0; yp < (208*belt); yp++) {printf("%.6f\r\n",yprint[yp]);};
         /////////////////////////
    // printf("1000r useconds %i\r\n", t.read_ms());
           wait_us(1);
@@ -277,9 +279,9 @@
     printf("\r\n");
     printf("# name: meas_volts\r\n");
     printf("# type: matrix\r\n");
-    printf("# rows: 256\r\n");
+    printf("# rows: 208\r\n");
     printf("# columns: 1\r\n");
-    for (yp = 0; yp < 256*belt; yp++) {printf("%.6g\r\n",yprint[yp]);};
+    for (yp = 0; yp < 208*belt; yp++) {printf("%.6g\r\n",yprint[yp]);};
     memset(yprint,0,sizeof yprint);
     printf("\r\n");
     printf("# name: time\r\n");
@@ -374,10 +376,10 @@
 
 void freqsq ()
 {
-    float period;
-    period = 1000/freqdata;
+    int period;
+    period = (int) 1000/freqdata;
     sq.period_us(period);
-    sq.pulsewidth_us(period/2);
+    sq.pulsewidth_us((int)period/2);
 }
 
 void sinus()
@@ -534,7 +536,7 @@
        //if ((j==0)&&(IE==0)){wait_ms(1);}
         for (k = 0; k<16; k++) {
                 if (k==15) {DI1 = k;DI2 = 0;} else {DI1 = k; DI2 = k+1; }
-                if ((DI1==II)||(DI1==IG)||(DI2==II)||(DI2==IG)){yprint[yp]=(0);yp++;continue;}
+                if ((DI1==II)||(DI1==IG)||(DI2==II)||(DI2==IG)){continue;}
                 DI1mux(); 
                 DI2mux();
                 wait_us(10);