application: fix voltage caculation
This commit is contained in:
parent
468f199d22
commit
7ede0c9862
|
@ -119,8 +119,9 @@ static float* measure_voltages(void)
|
||||||
adc_start_conversion_regular(ADC1); // start conversion (using trigger)
|
adc_start_conversion_regular(ADC1); // start conversion (using trigger)
|
||||||
while (!adc_eoc(ADC1)); // wait until conversion finished
|
while (!adc_eoc(ADC1)); // wait until conversion finished
|
||||||
adc_values[i] = adc_read_regular(ADC1); // read voltage value (clears flag)
|
adc_values[i] = adc_read_regular(ADC1); // read voltage value (clears flag)
|
||||||
voltages[i] = adc_values[i] * 1.21 / adc_values[0] * 2; // use 1.21 V internal voltage reference to get ADC voltage (there is a /2 voltage divider)
|
voltages[i] = adc_values[i] * 1.21 / adc_values[0]; // use 1.21 V internal voltage reference to get ADC voltage
|
||||||
}
|
}
|
||||||
|
voltages[1] *= 2.0; // the is a /2 voltage divider for target voltage
|
||||||
return voltages;
|
return voltages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue