1
0

Add wait for charging capacitance of ADC S/H

This commit is contained in:
tmk 2014-12-03 14:22:10 +09:00
parent 2d7973fc3f
commit 86f82dd02d

View File

@ -92,6 +92,7 @@ uint16_t battery_voltage(void)
volatile uint16_t bat; volatile uint16_t bat;
ADCSRA |= (1<<ADEN); ADCSRA |= (1<<ADEN);
_delay_ms(1); // wait for charging S/H capacitance
ADCSRA |= (1<<ADSC); ADCSRA |= (1<<ADSC);
while (ADCSRA & (1<<ADSC)) ; while (ADCSRA & (1<<ADSC)) ;