I don't think that's what you want.ADCIN 4, adval 'Read channel 4 to adval
adval1 = adval*2/100
adval2 = adval*4//10
Lcdout "POWER: ", DEC2 adval1, ".", DEC1 adval2," WATT "
Let's say that you have 4.8 V on the input. You'll get an A/D reading of 249.
249 * 2 / 100 = 4 This part is ok
249 * 4 = 996, and //10 gives 6
So that would display as 4.6 instead of 4.8
Or if you had 4.2 V, (214 A/D)
214 * 2 / 10 = 4 Still OK
214 * 4 = 856, and //10 gives 6
Still displays as 4.6 instead of 4.2
Here are some more resultsI think you should take another look at the formulas in post #9Code:Volts A/D Whole# 4*A/D //10 Result 5.00 255 5 1020 0 5.0 4.90 249 4 996 6 4.6 4.85 247 4 988 8 4.8 4.80 244 4 976 6 4.6 4.75 242 4 968 8 4.8 4.70 239 4 956 6 4.6 4.65 237 4 948 8 4.8 4.60 234 4 936 6 4.6 4.55 232 4 928 8 4.8 4.50 229 4 916 6 4.6 4.40 224 4 896 6 4.6 4.30 219 4 876 6 4.6 4.20 214 4 856 6 4.6




Bookmarks