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:
- 54:1697dc574b96
- Parent:
- 53:83a90a47c1fd
- Child:
- 55:2526b3317bc8
diff -r 83a90a47c1fd -r 1697dc574b96 main.cpp --- a/main.cpp Tue Feb 09 15:11:08 2016 +0000 +++ b/main.cpp Tue Feb 16 18:33:44 2016 +0000 @@ -2,6 +2,7 @@ // Sampling #include "DMA_sampling/adc.h" +#include "DMA_sampling/dac.h" // for debug purposes Serial pc(USBTX, USBRX); @@ -14,6 +15,9 @@ extern uint16_t sample_array0[]; extern uint16_t sample_array1[]; +extern uint16_t static_input_array0[]; +extern uint16_t static_input_array1[]; + using namespace std; int main() { @@ -24,18 +28,54 @@ pc.baud(230400); pc.printf("Starting\r\n"); + dac_init(); // initializes DAC + adc_init(); // always initialize adc before dma pc.printf("ADC Initialized\r\n"); dma_init(); // initializes DMAs + led_green = 1; pc.printf("\r\n\r\n\r\n"); while(1) { - pc.printf("%f",sample_array0[1]); - wait_ms(500); + //DMA_TCD2_CSR + //int counter = 0; + //pc.printf("Sample_array0[1]:%d\r\n",sample_array0[counter]); + //ADC0_SC1A = 0x0C; //AIEN = 0, DIFF = 0, Channel = AD12 (PTB2) + //ADC1_SC1A = 0x0E; //AIEN = 0, DIFF = 0, Channel = AD14 (PTB10) + //while( (ADC0_SC1A&ADC_SC1_COCO_MASK)) {} + //while( (ADC1_SC1A&ADC_SC1_COCO_MASK)) {} + //pc.printf("ADC0_RA:%d\r\n", ADC0_RA); + //pc.printf("ADC1_RA:%d\r\n", ADC1_RA); + + //for(int i = 0; i < len; i++) pc.printf("A%i: %d\t %d\r\n",i,sample_array0[i],sample_array1[i]); + //for(int i = 0; i < len; i++) pc.printf("B%i: %d\t %d\r\n",i,static_input_array0[i],static_input_array1[i]); + + //wait_ms(1000); + int store_var = DMA_TCD2_CSR; + if (store_var == 0x220) + { + DAC0_DAT0H = 0x0F; + wait_us(10); + //DMA_TCD0_CSR = 0x260; + } + if (store_var == 0x260) + { + DAC0_DAT0H = 0x00; + wait_us(10); + } + + //int store_var = DMA_TCD0_CSR; + pc.printf("DMA0: %x\r\n", DMA_TCD0_CSR); + pc.printf("DMA1: %x\r\n", DMA_TCD1_CSR); + pc.printf("DMA2: %x\r\n", DMA_TCD2_CSR); + pc.printf("DMA3: %x\r\n", DMA_TCD3_CSR); + + //wait_us(100); + } } \ No newline at end of file