Jared Baxter
/
Impedance_Fast_Circuitry
Fork of DSP_200kHz by
Diff: main.cpp
- Revision:
- 76:704fc58ffcd0
- Parent:
- 75:8bb94685c80b
- Child:
- 77:1ee17a9e9f8b
--- a/main.cpp Fri Jun 02 21:10:22 2017 +0000 +++ b/main.cpp Sun Jun 04 02:41:14 2017 +0000 @@ -8,6 +8,7 @@ #include "Jareds_DSP/demodulate.h" // DSP #include "dsp.h" +#include "print_data.h" #define PRINT_BUFFER_LENGTH 10000 #define GATHER_STATISTICS 1 @@ -76,6 +77,10 @@ pc.baud(230400); pc.printf("Starting\r\n"); + float Coeffs_50k[64] = {-0.00580977186764374, -0.00233724597509602, -0.00268496034893966, -0.00296892106107616, -0.00316332842506790, -0.00323734224087795, -0.00316066924650306, -0.00289929624029755, -0.00242701604537671, -0.00171828775863439, -0.000756395728753172, 0.000477926265449492, 0.00199540689821131, 0.00380158746045340, 0.00588165900929199, 0.00823408890481248, 0.0108348019613589, 0.0136476376350624, 0.0166466423869460, 0.0197784366663972, 0.0229973536627058, 0.0262449065159363, 0.0294642414819848, 0.0325921536969478, 0.0355683455017601, 0.0383295801638416, 0.0408195908282943, 0.0429841210797836, 0.0447761053872137, 0.0461555992329706, 0.0470945515138455, 0.0475679104762209, 0.0475679104762209, 0.0470945515138455, 0.0461555992329706, 0.0447761053872137, 0.0429841210797836, 0.0408195908282943, 0.0383295801638416, 0.0355683455017601, 0.0325921536969478, 0.0294642414819848, 0.0262449065159363, 0.0229973536627058, 0.0197784366663972, 0.0166466423869460, 0.0136476376350624, 0.0108348019613589, 0.00823408890481248, 0.00588165900929199, 0.00380158746045340, 0.00199540689821131, 0.000477926265449492, -0.000756395728753172, -0.00171828775863439, -0.00242701604537671, -0.00289929624029755, -0.00316066924650306, -0.00323734224087795, -0.00316332842506790, -0.00296892106107616, -0.00268496034893966, -0.00233724597509602, -0.00580977186764374}; + float Coeffs_6250[64] = {0.00127484193009558, 0.000864570357881826, 0.00102534214649288, 0.00108510384382452, 0.000993133224929705, 0.000703051795928013, 0.000176984381104620, -0.000604044101219087, -0.00163463261391366, -0.00287921914505944, -0.00427024372870053, -0.00570053545539321, -0.00703321069757274, -0.00810283335889244, -0.00872356764128486, -0.00870634354462360, -0.00786670117946960, -0.00604576027868247, -0.00312333623326739, 0.000966301735603311, 0.00622373889666060, 0.0125751900868018, 0.0198716618758688, 0.0278909988243224, 0.0363459953874327, 0.0449001710734076, 0.0531846513791541, 0.0608209828946068, 0.0674455509096558, 0.0727320474263388, 0.0764143241129908, 0.0783043078535981, 0.0783043078535981, 0.0764143241129908, 0.0727320474263388, 0.0674455509096558, 0.0608209828946068, 0.0531846513791541, 0.0449001710734076, 0.0363459953874327, 0.0278909988243224, 0.0198716618758688, 0.0125751900868018, 0.00622373889666060, 0.000966301735603311, -0.00312333623326739, -0.00604576027868247, -0.00786670117946960, -0.00870634354462360, -0.00872356764128486, -0.00810283335889244, -0.00703321069757274, -0.00570053545539321, -0.00427024372870053, -0.00287921914505944, -0.00163463261391366, -0.000604044101219087, 0.000176984381104620, 0.000703051795928013, 0.000993133224929705, 0.00108510384382452, 0.00102534214649288, 0.000864570357881826, 0.00127484193009558}; + float Coeffs_781[32] = {-0.00137496047241108, -0.00189912303426691, -0.00110565158528889, 0.00208160047524475, 0.00686479755292052, 0.0101590507660848, 0.00771645862767646, -0.00299753239510026, -0.0195878466903650, -0.0334711291636072, -0.0323084479325981, -0.00584063791909296, 0.0475547954053657, 0.117412154826256, 0.183528429426864, 0.223771458379020, 0.223771458379020, 0.183528429426864, 0.117412154826256, 0.0475547954053657, -0.00584063791909296, -0.0323084479325981, -0.0334711291636072, -0.0195878466903650, -0.00299753239510026, 0.00771645862767646, 0.0101590507660848, 0.00686479755292052, 0.00208160047524475, -0.00110565158528889, -0.00189912303426691, -0.00137496047241108}; + float Coeffs[20] = {0.0328368433284673, 0.0237706090075265, 0.0309894695180997, 0.0385253568846695, 0.0459996974310349, 0.0530165318016261, 0.0591943866845610, 0.0641755708098907, 0.0676960677594849, 0.0694621149975389, 0.0694621149975389, 0.0676960677594849, 0.0641755708098907, 0.0591943866845610, 0.0530165318016261, 0.0459996974310349, 0.0385253568846695, 0.0309894695180997, 0.0237706090075265, 0.0328368433284673}; float Coeffs2[20] = {-0.00506451294187997, -0.00824932319607346, -0.00986370066237912, -0.00518913235010027, 0.00950858650162284, 0.0357083149022659, 0.0711557142019980, 0.109659494661247, 0.142586101123340, 0.161603335553589, 0.161603335553589, 0.142586101123340, 0.109659494661247, 0.0711557142019980, 0.0357083149022659, 0.00950858650162284, -0.00518913235010027, -0.00986370066237912, -0.00824932319607346, -0.00506451294187997}; @@ -83,13 +88,13 @@ for(int i = 0; i < 8; i++) input_50k[i] = new float[32];//each array represents the input of the adcs - filters f3 = filters(8, 8, NULL, 8, 20, Coeffs2,false); + filters f3 = filters(8, 8, NULL, 8, 32, Coeffs_781,false); //6250->781 - filters f2 = filters(8, 8, &f3, 8, 20, Coeffs,false); + filters f2 = filters(8, 8, &f3, 8, 64, Coeffs_6250,false); //50,000->6250 - filters f1 = filters(4, 8, &f2, 32, 20, Coeffs,true); + filters f1 = filters(4, 8, &f2, 32, 64, Coeffs_50k,true); //float output_print_buffer[PRINT_BUFFER_LENGTH];//used to store the adc0 values(current measurment) @@ -115,6 +120,7 @@ while(sampling_status == 0)//wait until the ADCs read a new value { status_0 = 1; + print_filter_data(); //Thread::wait(.0001); } sampling_status = 0;//sets sampling status to 0. DMA sets it to one once ADCs sample