Fixed ADC0_init
This commit is contained in:
parent
86c127d3cd
commit
57a0c0979b
@ -34,6 +34,10 @@ void USART3_init(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ADC0_init(void) {
|
void ADC0_init(void) {
|
||||||
|
PORTD.PIN6CTRL &= ~PORT_ISC_gm;
|
||||||
|
PORTD.PIN6CTRL |= PORT_ISC_INPUT_DISABLE_gc;
|
||||||
|
PORTD.PIN6CTRL &= PORT_PULLUPEN_bm;
|
||||||
|
|
||||||
ADC0.CTRLC = ADC_PRESC_DIV4_gc;
|
ADC0.CTRLC = ADC_PRESC_DIV4_gc;
|
||||||
VREF.ADC0REF = VREF_REFSEL_VDD_gc; /* Internal reference */
|
VREF.ADC0REF = VREF_REFSEL_VDD_gc; /* Internal reference */
|
||||||
ADC0.CTRLA = ADC_ENABLE_bm /* ADC Enable: enabled */
|
ADC0.CTRLA = ADC_ENABLE_bm /* ADC Enable: enabled */
|
||||||
@ -93,7 +97,7 @@ int main(void) {
|
|||||||
adcVal = ADC0_read();
|
adcVal = ADC0_read();
|
||||||
VREF.ADC0REF = VREF_REFSEL_VDD_gc;
|
VREF.ADC0REF = VREF_REFSEL_VDD_gc;
|
||||||
printf("The values: \n");
|
printf("The values: \n");
|
||||||
//printf("%u , %u",VREF_REFSEL_VDD_gc , adcVal);
|
printf("%u , %u",VREF_REFSEL_VDD_gc , adcVal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user