ATmega32a ADC is not working

Thread Starter

awwsome

Joined Mar 10, 2018
3
I have been trying to get analog data from the sensor and convert it to digital using the ADC pins of the ATmega32a. The code is working fine with the simulation, but when i run the same code on ATmega32a it gives the 255 every time. I tried using the simple potential divider circuit using two 10k resistors but still, the output of the adc is 255. I even connected the adc pin to ground but the output didn't change.

Please help. Thanks in advance.
 

ericgibbs

Joined Jan 29, 2010
8,719
hi awwsome,
Welcome to AAC.
Do you have a circuit diagram showing how the AT is connected to the rest of the project.?

E
 

Thread Starter

awwsome

Joined Mar 10, 2018
3
I am simply using a development board of ATmega32a and I have connected the adc pin to a potential divider circuit ( where potential is 2.5v ).
The potential divider circuit is dividing the potential between ground and 5 volt. I haven't connected the rest of the project to ATmega32a since i am only focussing on correct conversion by the adc.
 

Papabravo

Joined Feb 24, 2006
12,389
I am simply using a development board of ATmega32a and I have connected the adc pin to a potential divider circuit ( where potential is 2.5v ).
The potential divider circuit is dividing the potential between ground and 5 volt. I haven't connected the rest of the project to ATmega32a since i am only focussing on correct conversion by the adc.
This is what we call a non-responsive answer. You were asked for a schematic and you return a verbal description. It sounds like there is a configuration problem with the pins where the real chip behaves differently from the simulation. Many pins on the ATmega series chips have multiple functions. Not configuring the pin correctly for the desired function has a high probability of producing the effect you describe. So that we can help you, we need a schematic of the development board, and we need to examine your code -- all of it. Do you get the message?
 

ericgibbs

Joined Jan 29, 2010
8,719
hi,
The reason for asking is so that we can check that the ADC support pins for the AT328 are connected as required, do you have a supplier link.?
E

Correction: AT32A not AT328.
 
Last edited:

Papabravo

Joined Feb 24, 2006
12,389
hi,
The reason for asking is so that we can check that the ADC support pins for the AT328 are connected as required, do you have a supplier link.?
E
Is it ATmega32A or is it ATmeg328? These two chips are not the same and the difference could be significant. Precision in these matters is essential. It might also be worth mentioning that the ADC on the ATmega32A has 10 bits, so the reference to a value of 255 is highly suspicious. So which part is the TS actually working with?
 

DickCappels

Joined Aug 21, 2008
5,876
If you probe the I/O pin corrosponding to the selected I/O channel with a DVM do you get a voltage that agrees with what tht ADC is telling it measured?

Check:
ananlog circuit
Reference voltage
I/O settings
 
Top