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.
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.
Instead of verbally describing the connections made, it would be better to show a circuit print for the ADC references, as well as to show the configuration for I/O and ADC registers that was programmed in the microcontroller code.