Have you tried putting a capacitor from the ADC in pin to ground? 22uf or larger. Might be easier than doing it in software.
Then after that do an average routine.
ADC_AVG = ADC_AVG + ADCIN
maybe five times in a for/next loop. Then divide ADC_AVG by five.
Bookmarks