I'm trying to read an NTC Thermistor that is connected to an adc pin on an Atmega32.
I'm not sure exactly how the thermistor probe should be connected. Currently it has one wire to ground, and the other wire is connected to adc0 on the atmega32 with a resistor to voltage in line. I'm not sure if that is the correct way to connect it or not.
I'm using the following code to read from the adc:
int x = 0; // Activate ADC with Prescaler 16 --> 1Mhz/16 = 62.5kHz ADCSRA = _BV(ADEN) | _BV(ADPS2); for (;;) { // select pin ADC0 using MUX ADMUX = 0; //Start conversion ADCSRA |= _BV(ADSC); // wait until converstion completed while (ADCSRA & _BV(ADSC) ) {} // get converted value x = ADCW; }
However, x is always 1023 (all 1's in 10 bit). X is 1023 even when the thermistor is not connected at all.
Can someone please give me any hints as to what I'm doing wrong?
Thanks!