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:
- 42:52a92a8d2cc7
- Parent:
- 41:3e0623d81b9a
- Child:
- 43:c593a8b9688f
diff -r 3e0623d81b9a -r 52a92a8d2cc7 main.cpp --- a/main.cpp Fri Jan 30 06:59:19 2015 +0000 +++ b/main.cpp Fri Jan 30 07:22:00 2015 +0000 @@ -61,7 +61,8 @@ pc.printf("Starting\r\n"); dma.reset(); - adc_init(A0); + adc_init(A1); + adc_init(A2); pc.printf("\r\n\r\n\r\n"); @@ -71,41 +72,25 @@ char temp = pc.getc(); switch(temp) { - case 's': - for(int i = 0; i < TOTAL_SAMPLES; i++) pc.printf("%i: %f\r\n",i,sample_array1[i]*3.3/65535); - - pc.printf("\r\n"); - break; - case 'f': - for(int i = 0; i < TOTAL_SAMPLES; i++) sample_array1[i] = 0xf; - break; - case 'd': - for(int i = 0; i < 3; i++) pc.printf("Sample[%i]: %x\r\n", i, sample_array1[i]); - break; case 'a': adc_start(); wait(1); adc_stop(); + // then proceed to 's' to display the array + case 's': + for(int i = 0; i < TOTAL_SAMPLES; i++) pc.printf("% 1i: %f\t% 1i: %f\r\n",i,sample_array1[i]*3.3/65535,i,sample_array2[i]*3.3/65535); + pc.printf("\r\n"); + break; + case 'f': + for(int i = 0; i < TOTAL_SAMPLES; i++) {sample_array1[i] = 0; sample_array2[i] = 0;} + pc.printf("Arrays cleared\r\n"); break; } } - //for(int i = 0; i < TOTAL_SAMPLES; i++) pc.printf("A%i: %f ",i,sample_array1[i]*3.3/65535); - - //pc.printf("ADC0_RA: %08x\r\n",ADC0_RA); - //pc.printf("ADC0_RB: %08x\r\n",ADC0_RB); - //for(int i = 0; i < TOTAL_SAMPLES; i++) pc.printf("B%i: %f ",i,sample_array2[i]*3.3/65535); - //for(int i = 0; i < TOTAL_SAMPLES; i++) pc.printf("C%i: %i ",i,angle_array[i]); - - //pc.printf("DMA_DADDR: %08x \r", *dma_daddr); - //pc.printf("A1: %f\tA2: %f\r\n", currA0, currA2); - //wait(1); } } void timed_sampling() { - // start ADC conversion - BW_ADC_SC1n_ADCH(0, 0, kAdcChannel12); // This corresponds to starting an ADC conversion on channel 12 of ADC 0 - which is A0 (PTB2) - BW_ADC_SC1n_ADCH(1, 0, kAdcChannel14); // This corresponds to starting an ADC conversion on channel 14 of ADC 1 - which is A2 (PTB10) // The following updates the rotary counter for the AMT20 sensor // Put A on PTC0 @@ -127,5 +112,4 @@ last_AMT20_AB_read = AMT20_AB; } -} - +} \ No newline at end of file