Trouble reading from ADC

Hi All,

We are using a ATmega328 micro on a project based on an Arduino with a 328. We have setup the registers correctly, and upload the compiled HEX file from Arduino to the micro over AVR Studio. The entire program executes as expected, with the exception of reading in analog.

When using the analogRead() function on our standalone micro it always returns 1023, the max value. On the Arduino it returns the correct value. We are also using I2C which operates correctly, which uses pins A4 and A5. I have also tried more than one micro so I can confidently say it's not a hardware issue.

Does anyone have any suggestions? Are there any differences that I might not be accounting for?

Thanks in advance.

Russ111: We have setup the registers correctly...

Which means the problem is not software.

On the Arduino it returns the correct value. I have also tried more than one micro so I can confidently say it's not a hardware issue.

Not a hardware problem.

The only thing left is the processor. Based on the information you have posted the problem is a defective processor.

Russ111: We have setup the registers correctly ...

...

Does anyone have any suggestions? Are there any differences that I might not be accounting for?

I suggest you post your code. Your idea of setting up registers correctly and mine might not coincide.

[quote author=Coding Badly link=topic=118662.msg893209#msg893209 date=1345045681] The only thing left is the processor. Based on the information you have posted the problem is a defective processor. [/quote]

Isn't that hardware?

Yup. But by "hardware" I assumed @Russ111 did not mean the board (or processor).