Joel Pallent
/
Elec241-adc
c
Diff: TEST.cpp
- Revision:
- 0:7088bc4c9949
diff -r 000000000000 -r 7088bc4c9949 TEST.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TEST.cpp Thu May 31 19:30:01 2018 +0000 @@ -0,0 +1,31 @@ +#include <stm32f4xx.h> +#include <stdio.h> +#include "ADC.h" +#include "PLL_Config.c" +#include "ADC.c" + + +float adc_data_f = 0; +unsigned short ADC_DATA = 0; + +int main(void) +{ + + //PLL_Config(); + SystemCoreClockUpdate(); + + init_ADC(); //config ADC + + while(1) + { + ADC_DATA=read_adc(); //read value from ADC + + adc_data_f=(float)ADC_DATA; + adc_data_f/=1000.0f; + adc_data_f = adc_data_f*0.80513; + printf("voltage = %0.2fv\n " , adc_data_f ); + + + } + +} \ No newline at end of file