Typically the use of the JTAG interface for debugging should be avoid when analyzing the performance of the ADC code section.
The use of the JTAG interface during debugging can easily be the source of glitches and ADC values well outside the acceptable range.
Modify your debugging tactics to exclude the use of the JTAG interface while testing the ADC sections of your code.
Both thermal and EMI noise can easily be the source of fluctuations in ADC values, particularly with higher resolution ADCs.
Particular attention must be made in regards to power supply design, decoupling and PCB design/layout.
There are several methods available to counter these fluctuations of the ADC conversion value:
1. Implementing a low pass/anti-aliasing filter to reduce aliasing
2. Separate well designed power supplies for the digital and analog sections
3. Well designed PCB with two separate ground planes
4. Proper use of decoupling capacitors at all appropriate locations.
There are also several soft techniques to improve the ADC conversion results.
1. Implement a moving/rolling average of a set number of ADC values
2. Reduce the number of bits of resolution of the ADC conversion value.
The following attached document may provide further insight into the issue.
BigDog