Wednesday, 15 June 2011

Displaying Analog Value on LCD using ADC of ATmega32



The previous blog example showed show to threshold the values of the analog sensor. But what if you wanted the actual analog voltage at the input port?
The answer lies in converting the digital value back to analog by using a simple formula

                     Van = (Vdi*5)/1024
This comes from the fact that 5V volts corresponds to 1024 in digital so x corresponds to what i.e, simple unitary method.
Since we have to display float values the compiler has to be notified with appropriate flags. So the Makefile has to change to reflect this.


Obviously, even the header file LCD.h has to be included.The analog voltage is given to the 0th adc channel via a potentiometer. The complete code for it.








1 comment:

Dilip Singh said...

when I tried this programme in a slight modified form then I get error on my lcd screen as volts: ??????????
and proteus also gave the warning as ad converter reference value 0

Post a Comment

Popular Posts