commit 26d4100490351b025f5f46c347277a554898ba67 parent 20caac98e4e5a6f613184293f9862fb84f4e0446 Author: William Lindholm <william_lindholm@outlook.com> Date: Tue, 15 Oct 2024 15:50:33 +0100 Fixed bug in ADC0 setup Diffstat:
| M | Project1/Project1/main.c | | | 2 | +- |
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Project1/Project1/main.c b/Project1/Project1/main.c @@ -123,7 +123,7 @@ void configure_TCA0(void) void configure_ADC0() { ADC0.CTRLA = ADC_RESSEL_8BIT_gc | ADC_FREERUN_bm; // Set 8 bit resolution and free run mode - ADC0.CTRLC = VREF_AC0REFSEL_AVDD_gc | ADC_PRESC_DIV128_gc; // Set reference voltage to 5V and set ADC prescaler to div 128 + ADC0.CTRLC = ADC_SAMPCAP_bm | ADC_REFSEL0_bm | ADC_PRESC_DIV128_gc; // Enable SAMPCAP, Set reference voltage to 5V and set ADC prescaler to div 128 ADC0.MUXPOS = ADC_MUXPOS_AIN3_gc; // Set input to Analog in 3 ADC0.INTCTRL = ADC_RESRDY_bm; // Enable interrupt on result ready ADC0.CTRLA |= ADC_ENABLE_bm; // Enable ADC