Hi,
The result from the ADC ranges from 0 to 1023, not 1024. Try using 1023 in the formula and see if that makes it better.
With that said the whole thing is a bit convoluted....Why do you multiply by 1000 only to divide the result by 10 directly after?
What's the voltage at the top of the resistor divider and what's VRef?
If both are 5V then the highest voltage on the ADC input would be 5/(1000+3500)*3500=3.888V giving an ADC reading of 3.888/(5/1024)=796.
If you multiply 796 by 100 (multiply by 1000, divide by 10) the result will still overflow a WORD.
/Henrik.




Bookmarks