Is this all of your code?
After a second look, this line looks like trouble?
ADCavg will keep adding up until it overflows. I don't see where you clear it or divide the results. Normally you would do a loop say 8 times summing the readings, then divide ADCavg by 8 to get the average. A running average has a few more steps. I would try to get the adc running first without averaging or formating. Start by applying 0 to 4 volts on your input. You should see 0 to 4095 on your lcd. Then you can add the averaging and lcd formatting.Code:ADCavg=ADCavg+ADCval 'Add latest ADC reading to running total




Bookmarks