hi, guys can someone take a look at my code and help me understand what's wrong.
void ADC_Initialize() { ADCSRA = (ADEN) | (ADSC) | (ADATE) | (ADIE) | (ADPS2) | (ADPS1) | (ADPS0); DIDR0 = (ADC0D); } ISR(ADC_vect) { adc_val = (ADCH << 8) | ADCL; }
and this is the main code below.
/* * oled lcd.c * * Created: 24-02-2020 18:10:18 * Author : jeet */ #define F_CPU 16000000UL #include <avr/io.h> #include <stdio.h> #include <avr/interrupt.h> #include "oled.c" #include "adc.c" int main(void) { sei(); OLED_Initialize(); ADC_Initialize(); while (1) { OLED_ClearScreen(); OLED_PrintLongInteger(adc_val,0); OLED_Render(); _delay_ms(1000); } }