
Impedance Fast Circuitry Software
Fork of DSP_200kHz by
Diff: main.cpp
- Revision:
- 79:5f24cfd685d8
- Parent:
- 78:10b2916b8f5c
- Child:
- 80:7a4856c596fc
--- a/main.cpp Tue Jun 06 18:15:00 2017 +0000 +++ b/main.cpp Tue Jun 20 16:49:19 2017 +0000 @@ -15,6 +15,8 @@ // for debug purposes +DigitalOut led1(LED1); +DigitalOut led2(LED2); Serial pc(USBTX, USBRX); DigitalOut led_red(LED_RED); DigitalOut led_green(LED_GREEN); @@ -38,6 +40,8 @@ float *input_50k[8]; +int probe_number = -1; +bool recording = false; @@ -64,20 +68,44 @@ } - +void callback() { + // Note: you need to actually read from the serial to clear the RX interrupt + printf("%c\n", pc.getc()); + led2 = !led2; +} int main() { - pre_compute_tables(); - precompute_tables(); - //turn off all LEDs + led_blue = 1; led_green = 1; led_red = 1; + pre_compute_tables(); + precompute_tables(); + //turn off all LEDs - int DAC_COUNTER = 0; + + + pc.baud(230400); - pc.printf("Starting\r\n"); + + //pc.printf("High: %x Mid: %x Low: %x",SIM->UIDH,SIM->UIDML,SIM->UIDL); + if(SIM->UIDH == 0x12ffff && SIM->UIDML == 0x4e453103 && SIM->UIDL == 0x60010030) probe_number = 1; + if(SIM->UIDH == 0x19ffff && SIM->UIDML == 0x4d441504 && SIM->UIDL == 0x90110031) probe_number = 2; + if(SIM->UIDH == 0x10ffff && SIM->UIDML == 0x4e453105 && SIM->UIDL == 0x100b0031) probe_number = 3; + if(SIM->UIDH == 0x14ffff && SIM->UIDML == 0x4e453154 && SIM->UIDL == 0x5009002b) probe_number = 4; + if(SIM->UIDH == 0x2effff && SIM->UIDML == 0x4e453154 && SIM->UIDL == 0x1004001e) probe_number = 5; + + /* + while(!pc.readable()) + { + continue; + } + pc.printf("%d",probe_number); + */ + int DAC_COUNTER = 0; + //SIM_UIDH == 0x20ffff && SIM_UIDML == 0x4e453103 && SIM_UIDL == 0x60010028) + //printf("High: %x Mid: %x Low: %x",SIM->UIDH,SIM->UIDML,SIM->UIDL); //Fs = 100000, FPass = 1500, FStop = 4500, -40db float Coeffs_100k[64] = {0.00368762746013400, -0.00390835182721185, -0.00352466159836192, -0.00378044968164769, -0.00434746630849834, -0.00502920744118478, -0.00570543677799210, -0.00628464650365093, -0.00668691824262464, -0.00683917139561193, -0.00667505410229485, -0.00613341508706847, -0.00516232410283893, -0.00371868951723358, -0.00177417571286934, 0.000685809876396031, 0.00365648516386919, 0.00711658039739992, 0.0110234409358280, 0.0153179248880130, 0.0199204447074274, 0.0247385052308702, 0.0296636617979935, 0.0345813441342327, 0.0393672306749833, 0.0438989152744108, 0.0480511039644129, 0.0517108728403463, 0.0547710075854812, 0.0571509837193129, 0.0587848911618005, 0.0596038010741317, 0.0596038010741317, 0.0587848911618005, 0.0571509837193129, 0.0547710075854812, 0.0517108728403463, 0.0480511039644129, 0.0438989152744108, 0.0393672306749833, 0.0345813441342327, 0.0296636617979935, 0.0247385052308702, 0.0199204447074274, 0.0153179248880130, 0.0110234409358280, 0.00711658039739992, 0.00365648516386919, 0.000685809876396031, -0.00177417571286934, -0.00371868951723358, -0.00516232410283893, -0.00613341508706847, -0.00667505410229485, -0.00683917139561193, -0.00668691824262464, -0.00628464650365093, -0.00570543677799210, -0.00502920744118478, -0.00434746630849834, -0.00378044968164769, -0.00352466159836192, -0.00390835182721185, 0.00368762746013400}; @@ -120,14 +148,19 @@ pc.printf("Buffer Size: %i\r\n", len); led_green = 1; - + pc.printf("High: %x Mid: %x Low: %x",SIM->UIDH,SIM->UIDML,SIM->UIDL); pc.printf("\r\n\r\n\r\n"); pdb_start(); //while(print_buffer_count<PRINT_BUFFER_LENGTH) while(!GATHER_STATISTICS||print_buffer_count<PRINT_BUFFER_LENGTH) { - + if(pc.readable())//if the python code has sent any characters recently + { + while(pc.readable()){pc.getc();} + pc.printf("p%d",probe_number); + } + while(sampling_status == 0)//wait until the ADCs read a new value { status_0 = 1;