Jared Baxter / Mbed 2 deprecated Impedance_Fast_Circuitry_print_V_I

Dependencies:   mbed-dsp mbed

Fork of Impedance_Fast_Circuitry by Jared Baxter

Revision:
77:1ee17a9e9f8b
Parent:
76:704fc58ffcd0
Child:
78:10b2916b8f5c
--- a/main.cpp	Sun Jun 04 02:41:14 2017 +0000
+++ b/main.cpp	Mon Jun 05 18:09:37 2017 +0000
@@ -21,6 +21,7 @@
 DigitalOut led_blue(LED_BLUE);
 DigitalOut status_0(D0);
 DigitalOut status_1(D1);
+DigitalOut status_3(D3);
 DigitalIn sw2(SW2);//Button 2
 DigitalIn sw3(SW3);//Button 3
 
@@ -86,16 +87,17 @@
     
 
     for(int i = 0; i < 8; i++)
-        input_50k[i] = new float[32];//each array represents the input of the adcs
+        input_50k[i] = new float[64];//each array represents the input of the adcs
         
-    filters f3 = filters(8, 8, NULL, 8, 32, Coeffs_781,false);
+    filters f3 = filters(4, 8, NULL, 8, 32, Coeffs_781,false);
     
     //6250->781
-    filters f2 = filters(8, 8, &f3, 8, 64, Coeffs_6250,false);
+    filters f2 = filters(4, 8, &f3, 8, 64, Coeffs_6250,false);
     
     //50,000->6250
-    filters f1 = filters(4, 8, &f2, 32, 64, Coeffs_50k,true); 
+    filters f1 = filters(2, 8, &f2, 64, 64, Coeffs_50k,true); 
     
+    filters f_pre = filters(2, 2, &f1, 64, 64, Coeffs_50k,false);
     
     //float output_print_buffer[PRINT_BUFFER_LENGTH];//used to store the adc0 values(current measurment)
     //float output_print_buffer2[PRINT_BUFFER_LENGTH];//used to store the adc0 values(voltage measurment)
@@ -117,36 +119,40 @@
     //while(print_buffer_count<PRINT_BUFFER_LENGTH) 
     while(!GATHER_STATISTICS||print_buffer_count<PRINT_BUFFER_LENGTH)
     {
+
         while(sampling_status == 0)//wait until the ADCs read a new value
         {   
             status_0 = 1;
-            print_filter_data();
+            print_filter_data(&pc);
             //Thread::wait(.0001);
         }
         sampling_status = 0;//sets sampling status to 0.  DMA sets it to one once ADCs sample
         status_0 = 0;//Tied to D0.  use an O-scope to measure how much free time there is to play with.
         status_1 = 1;//Tied to D1.  use an O-scope to measure how much time the processing takes
         
-        for(int i = 0; i < len; i+=2) 
+        for(int i = 0; i < len; i++) 
         {
             static_output_array0[i] = out_val_pre[DAC_COUNTER];//DAC output
             DAC_COUNTER++;//Counter to kepp track of where we are in our precomputed table
             if (DAC_COUNTER>=pre_compute_length) {DAC_COUNTER = 0;}//wrap around the counter
-            static_output_array0[i+1] = out_val_pre[DAC_COUNTER];//DAC output
-            DAC_COUNTER++;//Counter to kepp track of where we are in our precomputed table
-            if (DAC_COUNTER>=pre_compute_length) {DAC_COUNTER = 0;}//wrap around the counter
+            //static_output_array0[i+1] = out_val_pre[DAC_COUNTER];//DAC output
+            //DAC_COUNTER++;//Counter to kepp track of where we are in our precomputed table
+            //if (DAC_COUNTER>=pre_compute_length) {DAC_COUNTER = 0;}//wrap around the counter
             
-            input_50k[1][i/2]=static_input_array1[i];
-            input_50k[3][i/2]=static_input_array1[i+1];
-            input_50k[0][i/2]=static_input_array0[i];
-            input_50k[2][i/2]=static_input_array0[i+1];
+            input_50k[1][i]=float(static_input_array1[i]);
+           // input_50k[3][i/2]=static_input_array1[i+1];
+            input_50k[0][i]=float(static_input_array0[i]);
+            //input_50k[2][i/2]=static_input_array0[i+1];
             
             
             
         }//End of for loop going throught the buffer of adc samples
-        f1.input(input_50k,32);  
-        
-        
+        //input_50k[0] = static_input_array0;
+        //input_50k[1] = static_input_array1;
+        f_pre.input(input_50k,64);  
+        //status_3 = 1;
+        //pc.printf("Y");
+        //status_3 = 0;
         
         
         status_1 = 0;//turn off D1 used in deterimining how long processing is taking