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:
- 37:8bdc71f3e874
- Parent:
- 36:07d8a3143967
- Child:
- 38:ec3b16c130d7
--- a/main.cpp Sun Jan 25 09:10:24 2015 +0000 +++ b/main.cpp Tue Jan 27 17:12:37 2015 +0000 @@ -63,9 +63,23 @@ pc.baud(230400); pc.printf("Starting\r\n"); + // initialize the Programmable Delay Block + PDB0->MOD = ;// the period of the PDB + PDB0->SC |= PDB_SC_CONT_MASK; // run PDB in continuous mode + PDB0->SC |= PDB_SC_PDBEN_MASK; // enables the PDB + + + + analog_initialization(A0); analog_initialization(A2); + // put in high power mode for faster frequencies + ADC0->CFG1 |= ADC_CFG1_ADLPC_MASK; + + // put in continuous conversion mode + pc.printf("ADC0_SC3: %08x\r\n", ADC0->SC3); + // enable the DMA ADC0->SC2 |= ADC_SC2_DMAEN_MASK; ADC1->SC2 |= ADC_SC2_DMAEN_MASK; @@ -109,8 +123,6 @@ //pc.printf("A1: %f\tA2: %f\r\n", currA0, currA2); wait(1); } - - } void timed_sampling() { @@ -200,8 +212,8 @@ adc_hal_set_clock_divider_mode(instance, (adc_clock_divider_mode_t)(clkdiv & 0x3)); adc_hal_set_reference_voltage_mode(instance, kAdcVoltageVref); adc_hal_set_resolution_mode(instance, kAdcSingleDiff16); - adc_hal_configure_continuous_conversion(instance, false); - adc_hal_configure_hw_trigger(instance, false); // sw trigger + adc_hal_configure_continuous_conversion(instance, false); // true=continuous conversion mode, false = single conversion mode + adc_hal_configure_hw_trigger(instance, true); // true=hw trigger, false=sw trigger adc_hal_configure_hw_average(instance, false); adc_hal_set_hw_average_mode(instance, kAdcHwAverageCount4); adc_hal_set_group_mux(instance, kAdcChannelMuxB); // only B channels are avail