i'm currently messing around with the adc on my atmega8 just to get an understanding of how ADC works because i plan to make a guitar tuner based on a circuit i found on the internet.
my question is, with 5v going into my adc input port i get a reading of ~1024 which is expected, but when i run the supply through a voltage divider i get reading of 0 even though my multimeter shows a voltage of ~2,5v from the output of my divider circuit.
i think this might be a problem with my program? can anyone help me troubleshoot this?
here is the program i've written
thanks in advance for any solutions. i'm sorry if this is the wrong place to ask this question
EDIT:
I might be misunderstanding how to plug the input into the adc? i assume the adc port is connected to an output point between the two resistors but it doesn't seem to be reading it. both the microcontroller and the voltage divider share the same ground. what could be the issue?
i would also like to say that the lcd is working and all the ports are properly configured... it seems like the solution is very simple and i've just misunderstood how to properly hook up the circuit.
my question is, with 5v going into my adc input port i get a reading of ~1024 which is expected, but when i run the supply through a voltage divider i get reading of 0 even though my multimeter shows a voltage of ~2,5v from the output of my divider circuit.
i think this might be a problem with my program? can anyone help me troubleshoot this?
here is the program i've written
Code:
ADMUX = 0b00000000;
ADCSR = 0b10000000;
ADCSRA |= (1<<ADSC);
while (ADCSRA & (1<<ADSC));
adc_value = ADCW;
sprintf(buf,"%i ADC",adc_value);
lcd_clear();
lcd_puts(buf);
delay_ms(100);
thanks in advance for any solutions. i'm sorry if this is the wrong place to ask this question
EDIT:
I might be misunderstanding how to plug the input into the adc? i assume the adc port is connected to an output point between the two resistors but it doesn't seem to be reading it. both the microcontroller and the voltage divider share the same ground. what could be the issue?
i would also like to say that the lcd is working and all the ports are properly configured... it seems like the solution is very simple and i've just misunderstood how to properly hook up the circuit.
Last edited: