Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Impedance_Fast_Circuitry by
Diff: main.cpp
- Revision:
- 82:f6fbbb8a2139
- Parent:
- 81:30d699e951a8
- Child:
- 83:0d068da1c6b7
--- a/main.cpp Wed Aug 30 00:02:06 2017 +0000 +++ b/main.cpp Wed Aug 30 02:29:53 2017 +0000 @@ -34,6 +34,8 @@ extern uint16_t static_input_array1[];//ADC 1(measures the voltage between the probe and ground) extern uint16_t static_output_array0[];//DAC outputs whatever wave form we want. extern uint16_t sampling_status;//used to determine when adc's are done reading. +extern uint16_t out_val_pre[]; + #define INPUT_ARRAY_SIZE 32 #define DECIMATION_FACTOR 8 @@ -45,10 +47,9 @@ bool recording = false; - +/* #define pre_compute_length 176 #define SAMPLEFREQUENCY 100000 - #define CarrierFrequency (float(SAMPLEFREQUENCY)/pre_compute_length) //float i_mod_pre[demodulation_length+(INPUT_ARRAY_SIZE/DECIMATION_FACTOR)]; @@ -62,13 +63,13 @@ for(int precompute_counter = 0; precompute_counter < pre_compute_length; precompute_counter++){ out_val_pre[precompute_counter] = (int) ((cos(twopi * CarrierFrequency /SAMPLEFREQUENCY * precompute_counter)) * 2046.0 + 2048.0);//12 bit cos wave } - + //float decimated_frequency = 6250; //for(int precompute_counter = 0; precompute_counter < demodulation_length+(INPUT_ARRAY_SIZE/DECIMATION_FACTOR); precompute_counter++){ // i_mod_pre[precompute_counter] = (cos(twopi * CarrierFrequency / decimated_frequency * precompute_counter)); // q_mod_pre[precompute_counter] = (-sin(twopi * CarrierFrequency / decimated_frequency * precompute_counter)); -} +}*/ void callback() { // Note: you need to actually read from the serial to clear the RX interrupt @@ -81,7 +82,7 @@ led_green = 1; led_red = 1; - pre_compute_tables(); + //pre_compute_tables(); precompute_tables(); //turn off all LEDs @@ -90,15 +91,7 @@ pc.baud(230400); - float test_crashing = 1.0/0; - if (isinf(test_crashing)) - pc.printf("INF DETECTED"); - test_crashing = sqrt(-1.0); - if (isnan(test_crashing)) - pc.printf("NAN DETECTED"); - pc.printf("Demod Freq: %d\n\r",DEMOD_1000HZ); - pc.printf("1/0: %f\n\r", 1.0/0); - pc.printf("sqrt(-1): %f\n\r", sqrt(-1.0)); + //pc.printf("High: %x Mid: %x Low: %x",SIM->UIDH,SIM->UIDML,SIM->UIDL); @@ -149,12 +142,12 @@ filters f2 = filters(4, 8, &f3, 8, 64, Coeffs_12500,DEMOD_No_Demod); filters f1 = filters(2, 8, &f2, 64, 64, Coeffs_100k,DEMOD_200HZ); - /* + filters f4_b = filters(4, 8, NULL, 8, 32, Coeffs_782,DEMOD_No_Demod); filters f3_b = filters(4, 2, &f4_b, 4, 32, Coeffs_1563,DEMOD_No_Demod); filters f2_b = filters(4, 8, &f3_b, 8, 64, Coeffs_12500,DEMOD_No_Demod); filters f1_b = filters(2, 8, &f2_b, 64, 64, Coeffs_100k,DEMOD_1000HZ); - */ + //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) @@ -213,7 +206,7 @@ //input_50k[0] = static_input_array0; //input_50k[1] = static_input_array1; f1.input(input_50k,64,DEMOD_200HZ); - //f1_b.input(input_50k,64,DEMOD_1000HZ); + f1_b.input(input_50k,64,DEMOD_1000HZ); //status_3 = 1; //pc.printf("Y"); //status_3 = 0;