Hi Steve, Ed,
Just to clarify further, it can never return 65535 no matter how you configure it.
It'll look like this, where x is the actual conversion result returned by the 10 bit ADC:
Code:
ADRESH ADRESL
xxxxxxxx xx000000 Left justified, ADCON2.7 = 0 (default)
000000xx xxxxxxxx Right justified, ADCON2.7 = 1
With left justification the two most significant bits in ADRESL are the two least significant bits of the 10 bit result.
With right justification the two least significant bits in ADRESH are the two most significant bits of the 10 bit result.
If you have the ADC set to left justification but look at the result as a "normal" 16 bit value each LSB of the ADC result will change the 16 bit value by 64 since the LSB of the ADC result is aligned with ADRESL.6.
So, with left justification and the ADC saturated the maximum value it can return is 65472 since the 6 least significant bits in ADRESL will be 0.
/Henrik.
Bookmarks