analogRead() problem

I am using a standalone atmega32 chip loaded with a bootloader and now everything is compatible with Arduino (digital i/o, uart com, analogWrite) except the analogRead function which returns 0-~200 when the reference is set to DEFAULT and 0-~300 when analog reference is set to INTERNAL.

AREF pin is not connected, tried to connect to VCC via a 10k res but even that didn't do much, as values never go higher than 350.

For testing i am using a 100k pot between VCC and GND and cursor connected to analog pin 0, and serial communication to PC for feedback.

What happens if you hook a digital multimeter to the wiper of the pot ?

It takes the arduino out of the equation, you should get a smooth transition from 0 - 5 volts, it you don't its the pot or your wiring.

Leave the AREF unconnected and use the default setting for readings between 0 and 5V when you're using the arduino.

My measurements go from 0 to 4.90 Volts and I also tried shorting the analog input to VCC as happens when the cursor reaches the end of the pot, and I still get like 168.. no 1023 as it's supposed to return.

I had some powering issues with the micro.. may the whole ADC be fried? as same limits return from each of the analog inputs.

Could be the ADC is cooked, have you tried other analogue pins ?

Could be the ADC is cooked, have you tried other analogue pins ?

If the ADC is ccoked, it won't matter which pin you chose , nothing will work; there's only one ADC.

Bad choice of words, If it works on another pin, the ADC isn't cooked, just the original pin. It sometimes happens one pin doesn't work wheras another one does.

Powering any of the analog port pins with 0 to 5V returns a value from 0 to 185 in the Serial Monitor. The pins work ok when used as digital output pins.

Can this be a software problem? like a division factor?

Personally I'd swap the processor in the board and see if anything changes, but I have quite a few of them.... :wink: