
Impedance Fast Circuitry Software
Fork of DSP_200kHz by
Jareds_DSP/print_data.cpp@78:10b2916b8f5c, 2017-06-06 (annotated)
- Committer:
- baxterja
- Date:
- Tue Jun 06 18:15:00 2017 +0000
- Revision:
- 78:10b2916b8f5c
- Parent:
- 77:1ee17a9e9f8b
- Child:
- 81:30d699e951a8
- Child:
- 84:5b4466dd2326
Working Simultaneous excitation of multiple frequencies.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
baxterja | 76:704fc58ffcd0 | 1 | #include "print_data.h" |
baxterja | 76:704fc58ffcd0 | 2 | |
baxterja | 78:10b2916b8f5c | 3 | #define NUM_PRINT_INPUTS 2 |
baxterja | 77:1ee17a9e9f8b | 4 | DigitalOut status_2(D4); |
baxterja | 78:10b2916b8f5c | 5 | int printing_length[NUM_PRINT_INPUTS] = {0}; |
baxterja | 78:10b2916b8f5c | 6 | int printing_counter[NUM_PRINT_INPUTS] = {0}; |
baxterja | 78:10b2916b8f5c | 7 | char print_buffer[NUM_PRINT_INPUTS][50]; |
baxterja | 78:10b2916b8f5c | 8 | |
baxterja | 76:704fc58ffcd0 | 9 | |
baxterja | 77:1ee17a9e9f8b | 10 | |
baxterja | 77:1ee17a9e9f8b | 11 | void print_filter_data(Serial *pc) |
baxterja | 76:704fc58ffcd0 | 12 | { |
baxterja | 78:10b2916b8f5c | 13 | static int current_print_frequency = 0; |
baxterja | 78:10b2916b8f5c | 14 | if (printing_counter[current_print_frequency]>=printing_length[current_print_frequency]) |
baxterja | 78:10b2916b8f5c | 15 | { |
baxterja | 78:10b2916b8f5c | 16 | printing_counter[current_print_frequency]= 0; |
baxterja | 78:10b2916b8f5c | 17 | printing_length[current_print_frequency] = 0; |
baxterja | 78:10b2916b8f5c | 18 | current_print_frequency++; |
baxterja | 78:10b2916b8f5c | 19 | if (current_print_frequency>=NUM_PRINT_INPUTS) |
baxterja | 78:10b2916b8f5c | 20 | { |
baxterja | 78:10b2916b8f5c | 21 | current_print_frequency=0; |
baxterja | 78:10b2916b8f5c | 22 | } |
baxterja | 76:704fc58ffcd0 | 23 | return; |
baxterja | 78:10b2916b8f5c | 24 | } |
baxterja | 76:704fc58ffcd0 | 25 | status_2 = 1; |
baxterja | 77:1ee17a9e9f8b | 26 | //printf("Y"); |
baxterja | 78:10b2916b8f5c | 27 | pc->printf("%c",print_buffer[current_print_frequency][printing_counter[current_print_frequency]]); |
baxterja | 78:10b2916b8f5c | 28 | printing_counter[current_print_frequency]++; |
baxterja | 77:1ee17a9e9f8b | 29 | |
baxterja | 76:704fc58ffcd0 | 30 | status_2 = 0; |
baxterja | 76:704fc58ffcd0 | 31 | } |
baxterja | 78:10b2916b8f5c | 32 | void set_print_buffer(float mag,float phase, int print_identifier) |
baxterja | 76:704fc58ffcd0 | 33 | { |
baxterja | 77:1ee17a9e9f8b | 34 | |
baxterja | 78:10b2916b8f5c | 35 | |
baxterja | 76:704fc58ffcd0 | 36 | if (printing_counter<printing_length) |
baxterja | 76:704fc58ffcd0 | 37 | { |
baxterja | 76:704fc58ffcd0 | 38 | printf("PRINT OVERLOAD\n\r"); |
baxterja | 76:704fc58ffcd0 | 39 | } |
baxterja | 77:1ee17a9e9f8b | 40 | |
baxterja | 78:10b2916b8f5c | 41 | printing_length[print_identifier]=sprintf (print_buffer[print_identifier], "%d %E %f\n\r",print_identifier, mag, phase); |
baxterja | 78:10b2916b8f5c | 42 | //printing_counter[print_identifier] = 0; |
baxterja | 77:1ee17a9e9f8b | 43 | |
baxterja | 76:704fc58ffcd0 | 44 | } |