For my new project i have to display signed analog values on LCD. ie both positive and negative values i have to display on LCD. The ADC i am using is AD7714 and the MCU is ATmega8. I configured the ADC inputs in the differential input form and i set a constant voltage(+1V) at one of the ADC inputs as reference input and the value at next input is changing.
my plan is when the varying analog value is higher than the reference voltage set at one of the inputs, its considered as positive and when the value is lower than the set value its considered as negative.The range of values i have display is from -15 to +15 for the analog inputs 0V to 2V with +1V as reference. I can display the values from 0 to +15 ie for the analog input from 1V to 2V. but whenever i am trying to display the negative values its showing 295 on LCD. when i check i realize that -1 is showing as 295. but i have to display the value as -1. what i have to do...
Hi
i am really sorry for the late reply.
Yes it is showing as 295. I could see this when i am simply subtract the constant value(here i put 127) i am getting 295. And i am getting 0,+1,+2... values simply when the input values are greater than 127 like 127-127=0,128-127=+1....
so you put 0x127 hexadecimal not 127 decimal
0x127= 295.
How do you store your ADC value ?
into a byte, a word (16bits) , signed , unsigned ...
How do you scale the result -15 0 +15 value only with 2 digits ?
so post your code ...